Module talk:BaseConvert

About possible hexadecimal input. Unicode defines that the regular characters "0...9A...F" can be recognised as hexadecimal characters. There are no separate ch

Module talk:BaseConvert

Fringe feature

About possible hexadecimal input. Unicode defines that the regular characters "0...9A...F" can be recognised as hexadecimal characters. There are no separate characters defined for hex notation. All fine. Now there are more characters that, according to Unicode, may be recognised as hexadecimal. They are socalled Fullwidth form characters. (see here and here).

Characters in Unicode marked Hex_Digit=Yes[a]
0123456789ABCDEF Basic Latin, capitals Also ASCII_Hex_Digit=Yes
0123456789abcdef Basic Latin, small letters Also ASCII_Hex_Digit=Yes
0123456789ABCDEF Fullwidth forms, capitals
0123456789abcdef Fullwidth forms, small letters
a. ^"Unicode 17.0 UCD: PropList.txt". 2025-06-30. Retrieved 2025-09-11.

Their code points are U+FF10 .. U+FF19 (numbers 0-9), U+FF21 .. U+FF26 (A-F), U+FF41 .. U+FF46 (a-f). So, generally spoken, there could be hex input by this regular Unicode input. We could decide that this input should be recognised (and so converted in this template).
When or where does that Halfwidth input occur? The characters are pre-Unicode glyphs. If I understand it well, they are used in East Asian (CJK) texts, possibly for Western quotes (including Western numbers). So including them would make BaseConvert a more full generic template, especially when exporting the module from enwiki. -DePiep (talk) 21:43, 24 February 2013 (UTC)Reply

Ok, makes sense that this could be useful if this module is exported to other language wikis. I've added normalization of full-width chars. Toohool (talk) 00:11, 25 February 2013 (UTC)Reply
Amazingly and bright! And this way all bases are covered, not just 16. Thanks (also for taking time to decipher my post). -DePiep (talk) 09:18, 25 February 2013 (UTC)Reply

Strip off "#" from incoming hex numbers

Toohool can you make this work? I tried and it seemed to work fine on the Module:BaseConvert/sandbox and the Template:Module:BaseConvert/testcases (now deleted per my request). Thanks Technical 13 (talk) 17:54, 9 September 2013 (UTC)Reply

Not done: You are already autoconfirmed. You do not need to use this template to edit a semi-protected page. Thanks, Celestra (talk) 02:44, 11 September 2013 (UTC)Reply

It would be easy to do, but why? Is there some particular use case where this would be helpful? Toohool (talk) 06:09, 11 September 2013 (UTC)Reply

Suggestion: metatable allowing this to be called as 10to16 etc

In the sandbox (diff) there is a metatable set that allows this module to be called as

Markup Renders as
{{#invoke:BaseConvert/sandbox|16to10|  FF  }}

255

{{#invoke:BaseConvert/sandbox|10to36|500}}

DW

{{#invoke:BaseConvert/sandbox|10to16|Foo|default=0}}

0

This looks nicer and is clearer than the |base= argument which doesn't specify whether it's the input base or output base. All options except |base=, |from= and |n= are supported.

On a technical note: it doesn't interfere with the original convert function as the "real" members of p are checked before __index is called. It will run for anything of this form so e.g. 500to400 will be passed on to _convert, but if someone tries to call a function not of this form they will get the usual error message. User:GKFXtalk 08:27, 25 April 2021 (UTC)Reply

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.