#include <StringUtil.hpp>
Static Public Member Functions | |
static RexxString * | substr (const char *, size_t, RexxInteger *, RexxInteger *, RexxString *) |
static RexxInteger * | posRexx (const char *stringData, size_t length, RexxString *needle, RexxInteger *pstart, RexxInteger *range) |
static size_t | pos (const char *stringData, size_t haystack_length, RexxString *needle, size_t _start, size_t _range) |
static size_t | caselessPos (const char *stringData, size_t haystack_length, RexxString *needle, size_t _start, size_t _range) |
static RexxInteger * | lastPosRexx (const char *stringData, size_t haystackLen, RexxString *needle, RexxInteger *_start, RexxInteger *_range) |
static size_t | lastPos (const char *stringData, size_t hastackLen, RexxString *needle, size_t _start, size_t _range) |
static const char * | lastPos (const char *needle, size_t needleLen, const char *haystack, size_t haystackLen) |
static RexxString * | subchar (const char *stringData, size_t stringLength, RexxInteger *positionArg) |
static RexxArray * | makearray (const char *start, size_t length, RexxString *separator) |
static RexxArray * | makearray (RexxString *str, RexxString *separator) |
static size_t | caselessLastPos (const char *stringData, size_t haystackLen, RexxString *needle, size_t _start, size_t range) |
static const char * | caselessLastPos (const char *needle, size_t needleLen, const char *haystack, size_t haystackLen) |
static int | caselessCompare (const char *, const char *, size_t) |
static int | hexDigitToInt (char ch) |
static char | packByte (const char *String) |
static void | unpackNibble (int Val, char *p) |
static char | packNibble (const char *String) |
static RexxString * | packHex (const char *String, size_t StringLength) |
static size_t | chGetSm (char *Destination, const char *Source, size_t Length, size_t Count, const char *Set, size_t *ScannedSize) |
static size_t | validateSet (const char *String, size_t Length, const char *Set, int Modulus, bool Hex) |
static char | packByte2 (const char *Byte) |
static int | valSet (const char *String, size_t Length, const char *Set, int Modulus, size_t *PackedSize) |
static const char * | memcpbrk (const char *String, const char *Set, size_t Length) |
static RexxObject * | dataType (RexxString *String, char Option) |
static size_t | wordCount (const char *String, size_t StringLength) |
static void | skipNonBlanks (const char **String, size_t *StringLength) |
static void | skipBlanks (const char **String, size_t *StringLength) |
static size_t | nextWord (const char **String, size_t *StringLength, const char **NextString) |
static size_t | countStr (const char *hayStack, size_t hayStackLength, RexxString *needle) |
static size_t | caselessCountStr (const char *hayStack, size_t hayStackLength, RexxString *needle) |
static size_t | memPos (const char *string, size_t length, char target) |
static RexxInteger * | verify (const char *data, size_t stringLen, RexxString *ref, RexxString *option, RexxInteger *_start, RexxInteger *range) |
static RexxString * | subWord (const char *data, size_t length, RexxInteger *position, RexxInteger *plength) |
static RexxArray * | subWords (const char *data, size_t length, RexxInteger *position, RexxInteger *plength) |
static RexxString * | word (const char *data, size_t length, RexxInteger *position) |
static RexxInteger * | wordIndex (const char *data, size_t length, RexxInteger *position) |
static RexxInteger * | wordLength (const char *data, size_t length, RexxInteger *position) |
static RexxInteger * | wordPos (const char *data, size_t length, RexxString *phrase, RexxInteger *pstart) |
static RexxInteger * | caselessWordPos (const char *data, size_t length, RexxString *phrase, RexxInteger *pstart) |
static RexxArray * | words (const char *data, size_t length) |
static const char * | locateSeparator (const char *start, const char *end, const char *sepData, size_t sepLength) |
static bool | checkIsASCII (const char *s, size_t length) |
static bool | matchCharacter (char ch, const char *charSet, size_t len) |
Definition at line 50 of file StringUtil.hpp.
|
static |
Perform a caseless comparison of two strings
string1 | The first string to compare. |
string2 | The second string. |
length | The length to compare. |
Definition at line 580 of file StringUtil.cpp.
Referenced by RexxString::caselessAbbrev(), caselessLastPos(), caselessPos(), caselessWordPos(), RexxString::primitiveCaselessCompareTo(), RexxString::primitiveCaselessIsEqual(), RexxMutableBuffer::primitiveCaselessMatch(), RexxString::primitiveCaselessMatch(), RexxStart(), and RexxString::sortCaselessCompare().
|
static |
Count the occurences of a string within another string.
hayStack | Pointer to the haystack data. |
hayStackLength | Length of the haystack data. |
needle | The needle we're searching for |
Definition at line 1384 of file StringUtil.cpp.
References caselessPos(), and RexxString::getLength().
Referenced by RexxString::caselessChangeStr(), RexxMutableBuffer::caselessChangeStr(), RexxString::caselessCountStrRexx(), and RexxMutableBuffer::caselessCountStrRexx().
|
static |
Absolutely most primitive version of a caseless lastpos search. This version searches directly in a buffer rather than a Rexx String.
needle | Pointer to the needle string. |
needleLen | Length of the needle string. |
haystack | The pointer to the haystack string. |
haystackLen | The length of the haystack string. |
Definition at line 403 of file StringUtil.cpp.
References caselessCompare().
|
static |
Primitive level caseless lastpos search within a string buffer.
stringData | The maystack buffer. |
haystack_length | The length of the haystack. |
needle | The search needle. |
_start | The starting position. |
Definition at line 360 of file StringUtil.cpp.
References RexxString::getLength(), RexxString::getStringData(), and Numerics::minVal().
Referenced by RexxMutableBuffer::caselessLastPos(), RexxString::caselessLastPos(), and RexxString::caselessLastPosRexx().
|
static |
Primitive level search withint a string buffer.
stringData | The maystack buffer. |
haystack_length | The length of the haystack. |
needle | The search needle. |
_start | The starting position. |
Definition at line 205 of file StringUtil.cpp.
References caselessCompare(), RexxString::getLength(), RexxString::getStringData(), and Numerics::minVal().
Referenced by RexxMutableBuffer::caselessChangeStr(), caselessCountStr(), RexxString::caselessPos(), RexxMutableBuffer::caselessPos(), and RexxString::caselessPosRexx().
|
static |
Execute a caseless wordpos search on a buffer of data.
data | the source data buffer. |
length | the length of the buffer |
phrase | the search phrase. |
pstart | the starting position. |
Definition at line 1865 of file StringUtil.cpp.
References ARG_ONE, ARG_TWO, caselessCompare(), RexxString::getLength(), RexxString::getStringData(), IntegerZero, new_integer(), nextWord(), optionalPositionArgument(), stringArgument(), and wordCount().
Referenced by RexxMutableBuffer::caselessWordPos(), and RexxString::caselessWordPos().
|
static |
Checks if the buffer of data contains only ASCII characters.
data | the source data buffer. |
length | the length of the buffer |
Definition at line 1969 of file StringUtil.cpp.
Referenced by RexxMutableBuffer::appendCstring(), RexxMutableBuffer::checkIsASCII(), and RexxString::checkIsASCII().
|
static |
Scan string for next members of character set
Destination | The string where the characters are packed. |
Source | The source for the string data. |
Length | The length of the input string. |
Count | The number of valid characters in the string. |
Set | The set of allowed characters. |
ScannedSize | The returned scan size. |
Definition at line 835 of file StringUtil.cpp.
Referenced by RexxString::b2x(), and packHex().
|
static |
Count the occurences of a string within another string.
hayStack | Pointer to the haystack data. |
hayStackLength | Length of the haystack data. |
needle | The needle we're searching for |
Definition at line 1359 of file StringUtil.cpp.
References RexxString::getLength(), and pos().
Referenced by RexxString::changeStr(), RexxMutableBuffer::changeStr(), RexxString::countStrRexx(), and RexxMutableBuffer::countStrRexx().
|
static |
Perform primitive datatype validation.
String | The target string. |
Option | The type of data to validate. |
Definition at line 1082 of file StringUtil.cpp.
References ALPHANUM, BINARI, DATATYPE_9DIGITS, DATATYPE_ALPHANUMERIC, DATATYPE_BINARY, DATATYPE_HEX, DATATYPE_LOGICAL, DATATYPE_LOWERCASE, DATATYPE_MIXEDCASE, DATATYPE_NUMBER, DATATYPE_SYMBOL, DATATYPE_UPPERCASE, DATATYPE_VARIABLE, DATATYPE_WHOLE_NUMBER, Error_Incorrect_method_option, RexxString::getLength(), RexxString::getStringData(), HEX_CHAR_STR, IntegerZero, RexxNumberString::isInteger(), RexxString::isSymbol(), LOWER_ALPHA, memcpbrk(), MIXED_ALPHA, new_string(), RexxString::numberString(), RexxString::numberValue(), OREF_NULL, RexxNumberString::plus(), reportException(), STRING_BAD_VARIABLE, STRING_COMPOUND_NAME, STRING_NAME, STRING_STEM, TheFalseObject, TheTrueObject, UPPER_ALPHA, and valSet().
Referenced by RexxString::dataType().
|
static |
Convert a hex digit to it's integer value equivalent.
ch | The input character. |
Definition at line 618 of file StringUtil.cpp.
Referenced by packByte2(), and RexxString::x2b().
|
static |
Absolutely most primitive version of a lastpos search. This version searches directly in a buffer rather than a Rexx String.
needle | Pointer to the needle string. |
needleLen | Length of the needle string. |
haystack | The pointer to the haystack string. |
haystackLen | The length of the haystack string. |
Definition at line 321 of file StringUtil.cpp.
|
static |
Primitive level lastpos search within a string buffer.
stringData | The maystack buffer. |
haystack_length | The length of the haystack. |
needle | The search needle. |
_start | The starting position. |
Definition at line 278 of file StringUtil.cpp.
References RexxString::getLength(), RexxString::getStringData(), and Numerics::minVal().
Referenced by RexxString::lastPos(), and lastPosRexx().
|
static |
Locate the last positon of a string within the designated string buffer.
stringData | The stringData to search within. |
length | The length of the string data. |
needle | The needle to search for. |
pstart | The starting position. |
Definition at line 255 of file StringUtil.cpp.
References ARG_ONE, ARG_THREE, ARG_TWO, lastPos(), new_integer(), optionalLengthArgument(), optionalPositionArgument(), and stringArgument().
Referenced by RexxMutableBuffer::lastPos(), and RexxString::lastPosRexx().
|
static |
Search for a separator within a string segment.
start | The start position for the scan. |
end | The last possible position for a scan (taking the length of the separator into account). |
sepData | The separator data |
sepLength | the length of the separator. |
Definition at line 467 of file StringUtil.cpp.
Referenced by makearray().
|
static |
Carve the string buffer up into an array of string values.
start | The starting position of the buffer. |
length | The length of the buffer. |
separator | The optional separator character. |
Definition at line 493 of file StringUtil.cpp.
References ARG_ONE, RexxString::getLength(), RexxString::getStringData(), locateSeparator(), RexxList::makeArray(), new_array(), new_queue(), new_string(), OREF_NULL, RexxArray::put(), RexxQueue::queue(), and stringArgument().
Referenced by makearray(), RexxString::makeArrayRexx(), and RexxMutableBuffer::makeArrayRexx().
|
static |
Definition at line 564 of file StringUtil.cpp.
References RexxString::getLength(), RexxString::getStringData(), and makearray().
|
inlinestatic |
Definition at line 96 of file StringUtil.hpp.
Referenced by RexxString::strip(), and verify().
|
static |
Find the first occurrence of the set non-member in a string.
String | The string to search. |
Set | The character set. |
Length | The length to search. |
Definition at line 967 of file StringUtil.cpp.
Referenced by dataType().
|
static |
Definition at line 1399 of file StringUtil.cpp.
Referenced by RexxString::translate(), and RexxMutableBuffer::translate().
|
static |
Find the next word in the string.
String | The source string. |
StringLength | The length of the string (update on return). |
NextString | The next word position. |
Definition at line 1329 of file StringUtil.cpp.
References skipBlanks(), skipNonBlanks(), and StringLength().
Referenced by caselessWordPos(), RexxString::delWord(), RexxMutableBuffer::delWord(), RexxString::space(), RexxMutableBuffer::space(), subWord(), subWords(), word(), wordIndex(), wordLength(), wordPos(), and words().
|
static |
The value of the buffer contents interpreted as the binary expansion of a byte, with most significant bit in s[0] and least significant bit in s[7].
String | The string to pack |
Definition at line 644 of file StringUtil.cpp.
Referenced by packNibble().
|
static |
Pack 2 0123456789ABCDEFabcdef chars into byte
The value of the buffer contents interpreted as the hex expansion of a byte, with most significant nibble in s[0] and least significant nibble in s[2].
Byte | The pointer to the hex digit pair to pack. |
Definition at line 693 of file StringUtil.cpp.
References hexDigitToInt().
Referenced by packHex().
|
static |
pack a string of 'hex' digits in place
take two alpha chars and make into one byte
String | The string to pack |
StringLength | The length of the string. |
Definition at line 875 of file StringUtil.cpp.
References chGetSm(), RexxString::getWritableData(), RexxObject::messageSend(), packByte2(), raw_string(), StringLength(), and validateSet().
Referenced by RexxNumberString::d2xD2c(), RexxString::x2c(), and RexxString::x2dC2d().
|
static |
The value of the buffer contents interpreted as the binary expansion of a byte, with most significant bit in s[0] and least significant bit in s[7].
String | Pack 4 characters into a hex string value. |
Definition at line 668 of file StringUtil.cpp.
References packByte().
Referenced by RexxString::b2x().
|
static |
Primitive level search withint a string buffer.
stringData | The maystack buffer. |
haystack_length | The length of the haystack. |
needle | The search needle. |
_start | The starting position. |
Definition at line 155 of file StringUtil.cpp.
References RexxString::getLength(), RexxString::getStringData(), and Numerics::minVal().
Referenced by RexxMutableBuffer::changeStr(), countStr(), RexxString::pos(), and posRexx().
|
static |
Locate a string within the designated string buffer.
stringData | The stringData to search within. |
length | The length of the string data. |
needle | The needle to search for. |
pstart | The starting position. |
Definition at line 130 of file StringUtil.cpp.
References ARG_ONE, ARG_THREE, ARG_TWO, new_integer(), optionalLengthArgument(), optionalPositionArgument(), pos(), and stringArgument().
Referenced by RexxString::posRexx(), and RexxMutableBuffer::posRexx().
|
static |
Skip leading blanks in a string.
String | The target string. |
StringLength | The length of the string segment. |
Definition at line 1235 of file StringUtil.cpp.
References StringLength().
Referenced by RexxString::delWord(), RexxMutableBuffer::delWord(), nextWord(), and wordCount().
|
static |
Skip non-blank characters to the next whitespace char.
String | The source string. |
StringLength | The string length (update on return); |
Definition at line 1263 of file StringUtil.cpp.
References StringLength().
Referenced by nextWord(), and wordCount().
|
static |
Extract an individual character from a string buffer, returned as a string object.
stringData | The string buffer. |
stringLength | The length of the buffer. |
positionArg | The target position. |
Definition at line 442 of file StringUtil.cpp.
References ARG_ONE, new_string(), and positionArgument().
Referenced by RexxString::subchar(), and RexxMutableBuffer::subchar().
|
static |
Extract a substring from a data buffer.
string | The data buffer. |
stringLength | The length of the buffer. |
_position | The position argument for the starting position. |
_length | The substring length argument. |
pad | The padding argument. |
Definition at line 66 of file StringUtil.cpp.
References ARG_ONE, ARG_THREE, ARG_TWO, Numerics::minVal(), optionalLengthArgument(), optionalPadArgument(), positionArgument(), RexxString::put(), raw_string(), and RexxString::set().
Referenced by RexxString::substr(), and RexxMutableBuffer::substr().
|
static |
Do a subword operation on a buffer of data
data | The start of the data buffer. |
length | The length of the buffer |
position | The starting word position. |
plength | the count of words to return. |
Definition at line 1517 of file StringUtil.cpp.
References ARG_ONE, ARG_TWO, Numerics::MAX_WHOLENUMBER, new_string(), nextWord(), optionalLengthArgument(), positionArgument(), word(), wordLength(), and wordPos().
Referenced by RexxMutableBuffer::subWord(), and RexxString::subWord().
|
static |
Do a wordList operation on a buffer of data
data | The start of the data buffer. |
length | The length of the buffer |
position | The starting word position. |
plength | the count of words to return. |
Definition at line 1571 of file StringUtil.cpp.
References RexxArray::append(), ARG_ONE, ARG_TWO, Numerics::MAX_WHOLENUMBER, new_array(), new_string(), nextWord(), optionalLengthArgument(), optionalPositionArgument(), word(), wordLength(), and wordPos().
Referenced by RexxMutableBuffer::subWords(), and RexxString::subWords().
|
static |
convert nibble to 4 '0'/'1' chars
p[0], ..., p[3]: the four '0'/'1' chars representing the nibble
No terminating null character is produced
Val | The nibble to unpack. |
p | The location to unpack into. |
Definition at line 949 of file StringUtil.cpp.
Referenced by RexxString::x2b().
|
static |
Validate blocks in string
A string is considered valid if consists of zero or more characters belonging to the null-terminated C string set in groups of size modulus. The first group may have fewer than modulus characters. The groups are optionally separated by one or more blanks.
String | The string to validate. |
Length | The string length. |
Set | The valid characters in the set. |
Modulus | The size of the smallest allowed grouping. |
Hex | Indicates this is a hex or binary string. Used for issuing the correct error type. |
Definition at line 726 of file StringUtil.cpp.
References ch_SPACE, ch_TAB, Error_Incorrect_method_binblank, Error_Incorrect_method_hexblank, Error_Incorrect_method_invbin, Error_Incorrect_method_invhex, IntegerOne, new_string(), and reportException().
Referenced by RexxString::b2x(), packHex(), and RexxString::x2b().
|
static |
Validate blocks in string
A string is considered valid if consists of zero or more characters belonging to the null-terminated C string set in groups of size modulus. The first group may have fewer than modulus characters. The groups are optionally separated by one or more blanks.
String | The string to validate. |
Length | The string length. |
Set | The validation set. |
Modulus | The set modulus |
PackedSize | The final packed size. |
Definition at line 1005 of file StringUtil.cpp.
Referenced by dataType().
|
static |
Perform a verify operation on a section of data.
data | The data pointer |
stringLen | The length of the string to match |
ref | The reference search string. |
option | The match/nomatch option. |
_start | The starting offset for the match. |
Definition at line 1432 of file StringUtil.cpp.
References ARG_FOUR, ARG_ONE, ARG_THREE, ARG_TWO, Error_Incorrect_method_option, RexxString::getLength(), RexxString::getStringData(), IntegerZero, matchCharacter(), Numerics::minVal(), new_integer(), optionalLengthArgument(), optionalOptionArgument(), optionalPositionArgument(), reportException(), stringArgument(), VERIFY_MATCH, and VERIFY_NOMATCH.
Referenced by RexxMutableBuffer::verify(), and RexxString::verify().
|
static |
Extract a word from a buffer
data | The data pointer |
length | the length of the data buffer. |
position | the target word position. |
Definition at line 1629 of file StringUtil.cpp.
References ARG_ONE, new_string(), nextWord(), positionArgument(), wordLength(), and wordPos().
Referenced by subWord(), subWords(), RexxMutableBuffer::word(), RexxString::word(), wordIndex(), wordLength(), and words().
|
static |
Count the number of words in a string.
String | The string to count. |
StringLength | The length of the string. |
Definition at line 1294 of file StringUtil.cpp.
References skipBlanks(), skipNonBlanks(), and StringLength().
Referenced by caselessWordPos(), wordPos(), RexxMutableBuffer::words(), and RexxString::words().
|
static |
Return the index position for a given word
data | The data containing the words |
length | The length of the data buffer |
position | The target word position |
Definition at line 1696 of file StringUtil.cpp.
References ARG_ONE, IntegerZero, new_integer(), nextWord(), positionArgument(), word(), wordLength(), and wordPos().
Referenced by RexxMutableBuffer::wordIndex(), and RexxString::wordIndex().
|
static |
Return the length of the word located at a given index.
data | The data containing the word list. |
length | The length of the data buffer |
position | The target word position. |
Definition at line 1730 of file StringUtil.cpp.
References ARG_ONE, new_integer(), nextWord(), positionArgument(), word(), and wordPos().
Referenced by subWord(), subWords(), word(), wordIndex(), RexxMutableBuffer::wordLength(), RexxString::wordLength(), and words().
|
static |
Execute a wordpos search on a buffer of data.
data | the source data buffer. |
length | the length of the buffer |
phrase | the search phrase. |
pstart | the starting position. |
Definition at line 1759 of file StringUtil.cpp.
References ARG_ONE, ARG_TWO, RexxString::getLength(), RexxString::getStringData(), IntegerZero, new_integer(), nextWord(), optionalPositionArgument(), stringArgument(), and wordCount().
Referenced by subWord(), subWords(), word(), wordIndex(), wordLength(), RexxMutableBuffer::wordPos(), and RexxString::wordPos().
|
static |
Extract all words from a buffer
data | The data pointer |
length | the length of the data buffer. |
position | the target word position. |
Definition at line 1666 of file StringUtil.cpp.
References RexxArray::append(), new_array(), new_string(), nextWord(), word(), and wordLength().
Referenced by RexxMethod::loadExternalMethod(), and RoutineClass::loadExternalRoutine().