new functions: :chr, :asc, :asciiMap

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: new functions: :chr, :asc, :asciiMap

#31 Post by dbenham » 22 May 2011 15:59

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

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: new functions: :chr, :asc, :asciiMap

#32 Post by dbenham » 23 May 2011 19:39

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

FordPerfect
Posts: 2
Joined: 12 Oct 2023 14:49
Location: Switzerland

Re: new functions: :chr, :asc, :asciiMap

#33 Post by FordPerfect » 12 Oct 2023 14:54

Google site doesn't exist anymore. Archive.org check failed. :(

Anyone got the most recent file / version of the script...?

einstein1969
Expert
Posts: 960
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: new functions: :chr, :asc, :asciiMap

#34 Post by einstein1969 » 27 Oct 2023 11:02

look if this is valid...
Attachments
CharLib.zip
(8.66 KiB) Downloaded 544 times

Joe Caverly
Posts: 18
Joined: 11 Jul 2018 05:05

Re: new functions: :chr, :asc, :asciiMap

#35 Post by Joe Caverly » 28 Oct 2023 12:57

Found this on Github...

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.
https://github.com/ApexDevelopment/tiny ... harLib.bat

Joe

FordPerfect
Posts: 2
Joined: 12 Oct 2023 14:49
Location: Switzerland

Re: new functions: :chr, :asc, :asciiMap

#36 Post by FordPerfect » 04 Nov 2023 04:54

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? ;)

Post Reply