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:
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:
substring
Since: 1.0
String :TRIM String
Trims whitespace at beginning and end of a string.
Parameters:
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:
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:
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:
ASCII string
Since: 1.0
String :DEC2ASC Integer[] String?
Converts a list of decimal numbers to an ASCII string.
Parameters:
ASCII string
Since: 1.0
Integer :ASCII String
Returns the numeric (decimal) ASCII code of the character.
Parameters:
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:
ASCII character
Since: 1.0
: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:
- string
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:
- string to extract substring of
- x; 0 or greater: string offset, negative number: string offset from end
- (default -0) y; 0 or greater: number of characters to extract, negative number: string offset from end where to stop substring extraction
substring
Since: 1.0
String :TRIM String
Trims whitespace at beginning and end of a string.
Parameters:
- string to trim
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:
- ASCII string
- (default false) use 0x prefix
- (default " ") separator string
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:
- ASCII string
- (default " ") list item separator string
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:
- hexadecimal list
- (default " ") list item separator
ASCII string
Since: 1.0
String :DEC2ASC Integer[] String?
Converts a list of decimal numbers to an ASCII string.
Parameters:
- decimal list
- (default " ") list item separator string
ASCII string
Since: 1.0
Integer :ASCII String
Returns the numeric (decimal) ASCII code of the character.
Parameters:
- single character
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:
- ASCII offset number of character
ASCII character
Since: 1.0
cypressor - 29. Mär, 17:39