I discovered and fixed a bug in both :asc and :str2hex functions. The functions were failing if the input StrVar name collided with a local function variable.
The new version is available at Google Sites: dbenham Files
new functions: :chr, :asc, :asciiMap
Moderator: DosItHelp
Re: new functions: :chr, :asc, :asciiMap
Fixed bug in :chr, :hex2str and :rot13 relating to [Solved] Return ANY string across ENDLOCAL boundry - BUG!
Updated code available at the same place as last time.
Dave Benham
Updated code available at the same place as last time.
Dave Benham
-
- Posts: 2
- Joined: 12 Oct 2023 14:49
- Location: Switzerland
Re: new functions: :chr, :asc, :asciiMap
Google site doesn't exist anymore. Archive.org check failed.
Anyone got the most recent file / version of the script...?
Anyone got the most recent file / version of the script...?
-
- Expert
- Posts: 960
- Joined: 15 Jun 2012 13:16
- Location: Italy, Rome
Re: new functions: :chr, :asc, :asciiMap
look if this is valid...
- Attachments
-
- CharLib.zip
- (8.66 KiB) Downloaded 541 times
-
- Posts: 18
- Joined: 11 Jul 2018 05:05
Re: new functions: :chr, :asc, :asciiMap
Found this on Github...
https://github.com/ApexDevelopment/tiny ... harLib.bat
Joe
Code: Select all
:: CharLib.bat is a callable library of batch functions used to interconvert
:: between characters and numeric ASCII code values.
::
:: syntax:
::
:: [call] [path]CharLib function [arguments]
::
:: For a full list of available functions use:
::
:: CharLib help
::
:: For detailed help on a specific function use:
::
:: CharLib help FunctionName
::
:: All library functions give the correct result regardless whether delayed
:: expansion is enabled or disabled at the time of the call!
::
:: The following variables are reserved for this library and should only be
:: populated via a call to initLib: ASCII_10, ASCII_13, ASCII_26
::
:: Some code and many coding techniques are from www.dostips.com
:: The rest is original work by Dave Benham
:: Special thanks and much credit to www.dostips.com member Jeb for providing
:: numerous techniques to deal with problematic non-printable characters, the
:: original idea to use !map:#%%c=! as a fast lookup mechanism for :asc
:: and :str2hex, and most importantly for incredible coding techniques to
:: facilitate return of ANY string across a function endlocal boundry,
:: even if the function was called while delayed expansion was enabled.
Joe
-
- Posts: 2
- Joined: 12 Oct 2023 14:49
- Location: Switzerland
Re: new functions: :chr, :asc, :asciiMap
That's very kind of you, thanks.
In the meantime I started my own version and used the old basic idea.
I have the individual characters in an array, which is working well so far (I think).
Funny, I forgot the beep char and I was wondering, man, where does that come from?
In the meantime I started my own version and used the old basic idea.
I have the individual characters in an array, which is working well so far (I think).
Funny, I forgot the beep char and I was wondering, man, where does that come from?