Samstag, 29. März 2008

BATCHLIB_ Batchlib library string.cmd

The batchlib library string.cmd is part of the batchlib package. It provides the following subroutines:

:STRLEN: Returns the string length.
:SUBSTR: Extracts a substring. Works exactly the same the string substitution function %VAR:~x,y% does.
:TRIM: Trims whitespace at beginning and end of a string.
:GET_ASCII_CHARS: Returns a string containing all ASCII characters at their given offset.
:ASC2HEX: Converts the ASCII string to a space separated list of hex numbers.
:ASC2DEC: Converts an ASCII string to a space separated list of decimal numbers.
:HEX2ASC: Converts a list of hexadecimal numbers to an ASCII string.
:DEC2ASC: Converts a list of decimal numbers to an ASCII string.
:ASCII: Returns the numeric (decimal) ASCII code of the character.
:CHAR: Returns the ASCII character denoted by the decimal number.



Integer :STRLEN String
Returns the string length.
Parameters:
  1. string
Returns:
string length
Since: 1.0



String :SUBSTR String Integer Integer?
Extracts a substring. Works exactly the same the string substitution function %VAR:~x,y% does. Provides a way for dynamically extracting substrings.
Parameters:
  1. string to extract substring of
  2. x; 0 or greater: string offset, negative number: string offset from end
  3. (default -0) y; 0 or greater: number of characters to extract, negative number: string offset from end where to stop substring extraction
Returns:
substring
Since: 1.0



String :TRIM String
Trims whitespace at beginning and end of a string.
Parameters:
  1. string to trim
Returns:
trimmed string
Since: 1.0



String :GET_ASCII_CHARS
Returns a string containing all ASCII characters at their given offset. All (in batch) non-printable characters will be replaced by a space.
Returns:
all ASCII characters
Since: 1.0



String[] :ASC2HEX String Boolean? String?
Converts the ASCII string to a space separated list of hex numbers. For example "ABC" will be converted to "41 42 43".
Parameters:
  1. ASCII string
  2. (default false) use 0x prefix
  3. (default " ") separator string
Returns:
list of hex numbers
Since: 1.0



Integer[] :ASC2DEC String String?
Converts an ASCII string to a space separated list of decimal numbers. For each character in the the string it's decimal ASCII index will be used. For example the string "ABC" will be converted to "65 66 67".
Parameters:
  1. ASCII string
  2. (default " ") list item separator string
Returns:
list of decimals
Since: 1.0



String :HEX2ASC String[] String?
Converts a list of hexadecimal numbers to an ASCII string. Automatically detects if numbers are prefixed with "0x".
Parameters:
  1. hexadecimal list
  2. (default " ") list item separator
Returns:
ASCII string
Since: 1.0



String :DEC2ASC Integer[] String?
Converts a list of decimal numbers to an ASCII string.
Parameters:
  1. decimal list
  2. (default " ") list item separator string
Returns:
ASCII string
Since: 1.0



Integer :ASCII String
Returns the numeric (decimal) ASCII code of the character.
Parameters:
  1. single character
Returns:
ASCII code
Since: 1.0



String :CHAR Integer
Returns the ASCII character denoted by the decimal number. Non-printable characters will be returned as space.
Parameters:
  1. ASCII offset number of character
Returns:
ASCII character
Since: 1.0

Reflog

Informationstechnische Howtos, Hinweise und Merkwürdiges

Batchlib v1.0 2008-03-29

Aktuelle Beiträge

HOWTO_ O2 DSL Surf &...
Der O2 DSL Surf & Phone-Router ist für die...
cypressor - 12. Feb, 19:57
Uptweak Windows XP Home...
There are a lot of annoying limitations in Windows...
cypressor - 9. Okt, 19:30
BATCHLIB_ Batchlib package...
Download Batchlib package v1.0 (5 KB zip file) What...
cypressor - 29. Mrz, 19:10
BATCHLIB_ Batchlib library...
The batchlib library string.cmd is part of the batchlib...
cypressor - 29. Mrz, 18:10

Homepage Ticker

Links

Status

Online seit 4082 Tagen
Zuletzt aktualisiert: 25. Apr, 21:39
RSS XML 1.0 Button-Get-Firefox

batch
batchlib
howto
tech
video
Profil
Abmelden
Weblog abonnieren