Hello,
it's a job for USING$
Hello ThinBasic developpers.
May I suggest optionnal parameters to Bin_To_Hex$( string ) function ?![]()
A number of bytes grouping , an a separator string.
Bin_To_Hex$("Hello") gives 48656C6C6F
Bin_To_Hex$("Hello" , 2 ,":") should give 4865:6C6C:6F
and if no separator string is provided a space is used as default.
Bin_To_Hex$("Hello" , 2 ) should give 4865 6C6C 6F
I think it could improve readability.
Regards
Hello,
it's a job for USING$
ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64
I mean if a keyword has to be upgraded, it should be "USING$" so it can be useful for other purposes (versatility).
But you can achieve your goal with STRINSERT$:
'---Load Console Module Uses "Console" dim teststring as String Dim yourstring as string teststring = Bin_To_Hex$("Hello") 'gives 48656C6C6F printl teststring 'Bin_To_Hex$("Hello" , 2 ,":") should give 4865:6C6C:6F yourstring = StrInsert$(teststring,":",-4) printl yourstring 'and if no separator string is provided a space is used as default. 'Bin_To_Hex$("Hello" , 2 ) should give 4865 6C6C 6F yourstring = StrInsert$(teststring," ",-4) printl yourstring PrintL "Press a key to end program" '---Wait for a key press WaitKey
ThinBasic 1.11.6.0 ALPHA - Windows 8.1 x64
3 is IMO the best but it's not supported on anything before Python 3.6.
2 is good but I personally prefer to put the numbers in the placeholders as it just makes it easier to track which of the parameters to format is slotting in each placeholder.
Bookmarks