StringUtil Class Reference

#include <StringUtil.hpp>

Static Public Member Functions

static RexxStringsubstr (const char *, sizeB_t, RexxInteger *, RexxInteger *, RexxString *)
 
static RexxIntegerposRexx (const char *stringData, sizeB_t length, RexxString *needle, RexxInteger *pstart, RexxInteger *range)
 
static sizeB_t pos (const char *stringData, sizeB_t haystack_length, RexxString *needle, sizeB_t _start, sizeB_t _range)
 
static sizeB_t caselessPos (const char *stringData, sizeB_t haystack_length, RexxString *needle, sizeB_t _start, sizeB_t _range)
 
static RexxIntegerlastPosRexx (const char *stringData, sizeB_t haystackLen, RexxString *needle, RexxInteger *_start, RexxInteger *_range)
 
static sizeB_t lastPos (const char *stringData, sizeB_t hastackLen, RexxString *needle, sizeB_t _start, sizeB_t _range)
 
static const char * lastPos (const char *needle, sizeB_t needleLen, const char *haystack, sizeB_t haystackLen)
 
static RexxStringsubchar (const char *stringData, sizeB_t stringLength, RexxInteger *positionArg)
 
static RexxArraymakearray (const char *start, sizeB_t length, RexxString *separator)
 
static RexxArraymakearray (RexxString *str, RexxString *separator)
 
static sizeB_t caselessLastPos (const char *stringData, sizeB_t haystackLen, RexxString *needle, sizeB_t _start, sizeB_t range)
 
static const char * caselessLastPos (const char *needle, sizeB_t needleLen, const char *haystack, sizeB_t haystackLen)
 
static int caselessCompare (const char *, const char *, sizeB_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 RexxStringpackHex (const char *String, sizeB_t StringLength)
 
static sizeB_t chGetSm (char *Destination, const char *Source, sizeB_t Length, sizeB_t Count, const char *Set, sizeB_t *ScannedSize)
 
static size_t validateSet (const char *String, sizeB_t Length, const char *Set, int Modulus, bool Hex)
 
static char packByte2 (const char *Byte)
 
static int valSet (const char *String, sizeB_t Length, const char *Set, int Modulus, size_t *PackedSize)
 
static const char * memcpbrk (const char *String, const char *Set, sizeB_t Length)
 
static RexxObjectdataType (RexxString *String, char Option)
 
static size_t wordCount (const char *String, sizeB_t StringLength)
 
static void skipNonBlanks (const char **String, sizeB_t *StringLength)
 
static void skipBlanks (const char **String, sizeB_t *StringLength)
 
static sizeB_t nextWord (const char **String, sizeB_t *StringLength, const char **NextString)
 
static size_t countStr (const char *hayStack, sizeB_t hayStackLength, RexxString *needle)
 
static size_t caselessCountStr (const char *hayStack, sizeB_t hayStackLength, RexxString *needle)
 
static size_t memPos (const char *string, sizeB_t length, char target)
 
static RexxIntegerverify (const char *data, sizeB_t stringLen, RexxString *ref, RexxString *option, RexxInteger *_start, RexxInteger *range)
 
static RexxStringsubWord (const char *data, sizeB_t length, RexxInteger *position, RexxInteger *plength)
 
static RexxArraysubWords (const char *data, sizeB_t length, RexxInteger *position, RexxInteger *plength)
 
static RexxStringword (const char *data, sizeB_t length, RexxInteger *position)
 
static RexxIntegerwordIndex (const char *data, sizeB_t length, RexxInteger *position)
 
static RexxIntegerwordLength (const char *data, sizeB_t length, RexxInteger *position)
 
static RexxIntegerwordPos (const char *data, sizeB_t length, RexxString *phrase, RexxInteger *pstart)
 
static RexxIntegercaselessWordPos (const char *data, sizeB_t length, RexxString *phrase, RexxInteger *pstart)
 
static RexxArraywords (const char *data, sizeB_t length)
 
static const char * locateSeparator (const char *start, const char *end, const char *sepData, sizeB_t sepLength)
 
static bool matchCharacter (char ch, const char *charSet, sizeB_t len)
 

Detailed Description

Definition at line 50 of file StringUtil.hpp.

Member Function Documentation

◆ caselessCompare()

int StringUtil::caselessCompare ( const char *  string1,
const char *  string2,
sizeB_t  length 
)
static

Perform a caseless comparison of two strings

Parameters
string1The first string to compare.
string2The second string.
lengthThe length to compare.
Returns
0 if the two strings are equal, -1 if the first is less than the second, and 1 if the first string is the greater.

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().

◆ caselessCountStr()

size_t StringUtil::caselessCountStr ( const char *  hayStack,
sizeB_t  hayStackLength,
RexxString needle 
)
static

Count the occurences of a string within another string.

Parameters
hayStackPointer to the haystack data.
hayStackLengthLength of the haystack data.
needleThe needle we're searching for
Returns
The count of needle occurrences located in the string.

Definition at line 1372 of file StringUtil.cpp.

References caselessPos(), and RexxString::getBLength().

Referenced by RexxString::caselessChangeStr(), RexxMutableBuffer::caselessChangeStr(), RexxString::caselessCountStrRexx(), and RexxMutableBuffer::caselessCountStrRexx().

◆ caselessLastPos() [1/2]

const char * StringUtil::caselessLastPos ( const char *  needle,
sizeB_t  needleLen,
const char *  haystack,
sizeB_t  haystackLen 
)
static

Absolutely most primitive version of a caseless lastpos search. This version searches directly in a buffer rather than a Rexx String.

Parameters
needlePointer to the needle string.
needleLenLength of the needle string.
haystackThe pointer to the haystack string.
haystackLenThe length of the haystack string.
Returns
A pointer to the match location or NULL if there is no match.

Definition at line 403 of file StringUtil.cpp.

References caselessCompare().

◆ caselessLastPos() [2/2]

sizeB_t StringUtil::caselessLastPos ( const char *  stringData,
sizeB_t  haystackLen,
RexxString needle,
sizeB_t  _start,
sizeB_t  range 
)
static

Primitive level caseless lastpos search within a string buffer.

Parameters
stringDataThe maystack buffer.
haystack_lengthThe length of the haystack.
needleThe search needle.
_startThe starting position.
Returns
The offset of the located needle, or 0 if the needle doesn't exist.

Definition at line 360 of file StringUtil.cpp.

References RexxString::getBLength(), RexxString::getStringData(), Numerics::minVal(), and sizeB_v.

Referenced by RexxMutableBuffer::caselessLastPos(), RexxString::caselessLastPos(), and RexxString::caselessLastPosRexx().

◆ caselessPos()

sizeB_t StringUtil::caselessPos ( const char *  stringData,
sizeB_t  haystack_length,
RexxString needle,
sizeB_t  _start,
sizeB_t  _range 
)
static

Primitive level search withint a string buffer.

Parameters
stringDataThe maystack buffer.
haystack_lengthThe length of the haystack.
needleThe search needle.
_startThe starting position.
Returns
The offset of the located needle, or 0 if the needle doesn't exist.

Definition at line 205 of file StringUtil.cpp.

References caselessCompare(), RexxString::getBLength(), RexxString::getStringData(), and Numerics::minVal().

Referenced by RexxMutableBuffer::caselessChangeStr(), caselessCountStr(), RexxString::caselessPos(), RexxMutableBuffer::caselessPos(), and RexxString::caselessPosRexx().

◆ caselessWordPos()

RexxInteger * StringUtil::caselessWordPos ( const char *  data,
sizeB_t  length,
RexxString phrase,
RexxInteger pstart 
)
static

Execute a caseless wordpos search on a buffer of data.

Parameters
datathe source data buffer.
lengththe length of the buffer
phrasethe search phrase.
pstartthe starting position.
Returns
the location of the start of the search phrase.

Definition at line 1853 of file StringUtil.cpp.

References ARG_ONE, ARG_TWO, caselessCompare(), RexxString::getBLength(), RexxString::getStringData(), IntegerZero, new_integer(), nextWord(), optionalPositionArgument(), stringArgument(), and wordCount().

Referenced by RexxMutableBuffer::caselessWordPos(), and RexxString::caselessWordPos().

◆ chGetSm()

sizeB_t StringUtil::chGetSm ( char *  Destination,
const char *  Source,
sizeB_t  Length,
sizeB_t  Count,
const char *  Set,
sizeB_t ScannedSize 
)
static

Scan string for next members of character set

Parameters
DestinationThe string where the characters are packed.
SourceThe source for the string data.
LengthThe length of the input string.
CountThe number of valid characters in the string.
SetThe set of allowed characters.
ScannedSizeThe returned scan size.
Returns

Definition at line 835 of file StringUtil.cpp.

Referenced by RexxString::b2x(), and packHex().

◆ countStr()

size_t StringUtil::countStr ( const char *  hayStack,
sizeB_t  hayStackLength,
RexxString needle 
)
static

Count the occurences of a string within another string.

Parameters
hayStackPointer to the haystack data.
hayStackLengthLength of the haystack data.
needleThe needle we're searching for
Returns
The count of needle occurrences located in the string.

Definition at line 1347 of file StringUtil.cpp.

References RexxString::getBLength(), and pos().

Referenced by RexxString::changeStr(), RexxMutableBuffer::changeStr(), RexxString::countStrRexx(), and RexxMutableBuffer::countStrRexx().

◆ dataType()

◆ hexDigitToInt()

int StringUtil::hexDigitToInt ( char  ch)
static

Convert a hex digit to it's integer value equivalent.

Parameters
chThe input character.
Returns
the integer value of the digit.

Definition at line 618 of file StringUtil.cpp.

Referenced by packByte2(), and RexxString::x2b().

◆ lastPos() [1/2]

const char * StringUtil::lastPos ( const char *  needle,
sizeB_t  needleLen,
const char *  haystack,
sizeB_t  haystackLen 
)
static

Absolutely most primitive version of a lastpos search. This version searches directly in a buffer rather than a Rexx String.

Parameters
needlePointer to the needle string.
needleLenLength of the needle string.
haystackThe pointer to the haystack string.
haystackLenThe length of the haystack string.
Returns
A pointer to the match location or NULL if there is no match.

Definition at line 321 of file StringUtil.cpp.

◆ lastPos() [2/2]

sizeB_t StringUtil::lastPos ( const char *  stringData,
sizeB_t  haystackLen,
RexxString needle,
sizeB_t  _start,
sizeB_t  range 
)
static

Primitive level lastpos search within a string buffer.

Parameters
stringDataThe maystack buffer.
haystack_lengthThe length of the haystack.
needleThe search needle.
_startThe starting position.
Returns
The offset of the located needle, or 0 if the needle doesn't exist.

Definition at line 278 of file StringUtil.cpp.

References RexxString::getBLength(), RexxString::getStringData(), Numerics::minVal(), and sizeB_v.

Referenced by RexxString::lastPos(), and lastPosRexx().

◆ lastPosRexx()

RexxInteger * StringUtil::lastPosRexx ( const char *  stringData,
sizeB_t  haystackLen,
RexxString needle,
RexxInteger _start,
RexxInteger _range 
)
static

Locate the last positon of a string within the designated string buffer.

Parameters
stringDataThe stringData to search within.
lengthThe length of the string data.
needleThe needle to search for.
pstartThe starting position.
Returns
An integer object giving the located position.

Definition at line 255 of file StringUtil.cpp.

References ARG_ONE, ARG_THREE, ARG_TWO, lastPos(), new_integer(), optionalLengthArgument(), optionalPositionArgument(), size_v, and stringArgument().

Referenced by RexxMutableBuffer::lastPos(), and RexxString::lastPosRexx().

◆ locateSeparator()

const char * StringUtil::locateSeparator ( const char *  start,
const char *  end,
const char *  sepData,
sizeB_t  sepLength 
)
static

Search for a separator within a string segment.

Parameters
startThe start position for the scan.
endThe last possible position for a scan (taking the length of the separator into account).
sepDataThe separator data
sepLengththe length of the separator.
Returns
The next match position, or null for no match.

Definition at line 467 of file StringUtil.cpp.

Referenced by makearray().

◆ makearray() [1/2]

RexxArray * StringUtil::makearray ( const char *  start,
sizeB_t  length,
RexxString separator 
)
static

Carve the string buffer up into an array of string values.

Parameters
startThe starting position of the buffer.
lengthThe length of the buffer.
separatorThe optional separator character.
Returns
An array of all strings within the buffer, with the target delimiter removed.

Definition at line 493 of file StringUtil.cpp.

References ARG_ONE, RexxString::getBLength(), RexxString::getStringData(), locateSeparator(), RexxList::makeArray(), new_array(), new_queue(), new_string(), OREF_NULL, RexxArray::put(), RexxQueue::queue(), size_v, and stringArgument().

Referenced by makearray(), RexxString::makeArrayRexx(), and RexxMutableBuffer::makeArrayRexx().

◆ makearray() [2/2]

RexxArray * StringUtil::makearray ( RexxString str,
RexxString separator 
)
static

◆ matchCharacter()

static bool StringUtil::matchCharacter ( char  ch,
const char *  charSet,
sizeB_t  len 
)
inlinestatic

Definition at line 95 of file StringUtil.hpp.

Referenced by RexxString::strip(), and verify().

◆ memcpbrk()

const char * StringUtil::memcpbrk ( const char *  String,
const char *  Set,
sizeB_t  Length 
)
static

Find the first occurrence of the set non-member in a string.

Parameters
StringThe string to search.
SetThe character set.
LengthThe length to search.
Returns
The position of a match.

Definition at line 955 of file StringUtil.cpp.

Referenced by dataType().

◆ memPos()

size_t StringUtil::memPos ( const char *  string,
sizeB_t  length,
char  target 
)
static

Definition at line 1387 of file StringUtil.cpp.

Referenced by RexxString::translate(), and RexxMutableBuffer::translate().

◆ nextWord()

sizeB_t StringUtil::nextWord ( const char **  String,
sizeB_t StringLength,
const char **  NextString 
)
static

Find the next word in the string.

Parameters
StringThe source string.
StringLengthThe length of the string (update on return).
NextStringThe next word position.
Returns
The length of the located word.

Definition at line 1317 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().

◆ packByte()

char StringUtil::packByte ( const char *  String)
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].

Parameters
StringThe string to pack
Returns
The single packed character.

Definition at line 644 of file StringUtil.cpp.

Referenced by packNibble().

◆ packByte2()

char StringUtil::packByte2 ( const char *  Byte)
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].

Parameters
ByteThe pointer to the hex digit pair to pack.
Returns
The single byte encoding of the pair of digits.

Definition at line 693 of file StringUtil.cpp.

References hexDigitToInt().

Referenced by packHex().

◆ packHex()

RexxString * StringUtil::packHex ( const char *  String,
sizeB_t  StringLength 
)
static

pack a string of 'hex' digits in place

take two alpha chars and make into one byte

Parameters
StringThe string to pack
StringLengthThe length of the string.
Returns
The resulting packed string.

Definition at line 875 of file StringUtil.cpp.

References chGetSm(), RexxString::getWritableData(), packByte2(), raw_string(), StringLength(), and validateSet().

Referenced by RexxNumberString::d2xD2c(), RexxString::x2c(), and RexxString::x2dC2d().

◆ packNibble()

char StringUtil::packNibble ( const char *  String)
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].

Parameters
StringPack 4 characters into a hex string value.
Returns
The hex character representing the nibble value.

Definition at line 668 of file StringUtil.cpp.

References packByte().

Referenced by RexxString::b2x().

◆ pos()

sizeB_t StringUtil::pos ( const char *  stringData,
sizeB_t  haystack_length,
RexxString needle,
sizeB_t  _start,
sizeB_t  _range 
)
static

Primitive level search withint a string buffer.

Parameters
stringDataThe maystack buffer.
haystack_lengthThe length of the haystack.
needleThe search needle.
_startThe starting position.
Returns
The offset of the located needle, or 0 if the needle doesn't exist.

Definition at line 155 of file StringUtil.cpp.

References RexxString::getBLength(), RexxString::getStringData(), Numerics::minVal(), and size_v.

Referenced by RexxMutableBuffer::changeStr(), countStr(), RexxString::pos(), and posRexx().

◆ posRexx()

RexxInteger * StringUtil::posRexx ( const char *  stringData,
sizeB_t  length,
RexxString needle,
RexxInteger pstart,
RexxInteger range 
)
static

Locate a string within the designated string buffer.

Parameters
stringDataThe stringData to search within.
lengthThe length of the string data.
needleThe needle to search for.
pstartThe starting position.
Returns
An integer object giving the located position.

Definition at line 130 of file StringUtil.cpp.

References ARG_ONE, ARG_THREE, ARG_TWO, new_integer(), optionalLengthArgument(), optionalPositionArgument(), pos(), size_v, and stringArgument().

Referenced by RexxString::posRexx(), and RexxMutableBuffer::posRexx().

◆ skipBlanks()

void StringUtil::skipBlanks ( const char **  String,
sizeB_t StringLength 
)
static

Skip leading blanks in a string.

Parameters
StringThe target string.
StringLengthThe length of the string segment.

Definition at line 1223 of file StringUtil.cpp.

References StringLength().

Referenced by RexxString::delWord(), RexxMutableBuffer::delWord(), nextWord(), and wordCount().

◆ skipNonBlanks()

void StringUtil::skipNonBlanks ( const char **  String,
sizeB_t StringLength 
)
static

Skip non-blank characters to the next whitespace char.

Parameters
StringThe source string.
StringLengthThe string length (update on return);

Definition at line 1251 of file StringUtil.cpp.

References StringLength().

Referenced by nextWord(), and wordCount().

◆ subchar()

RexxString * StringUtil::subchar ( const char *  stringData,
sizeB_t  stringLength,
RexxInteger positionArg 
)
static

Extract an individual character from a string buffer, returned as a string object.

Parameters
stringDataThe string buffer.
stringLengthThe length of the buffer.
positionArgThe target position.
Returns
The target character, as a string value.

Definition at line 442 of file StringUtil.cpp.

References ARG_ONE, new_string(), and positionArgument().

Referenced by RexxString::subchar(), and RexxMutableBuffer::subchar().

◆ substr()

RexxString * StringUtil::substr ( const char *  string,
sizeB_t  stringLength,
RexxInteger _position,
RexxInteger _length,
RexxString pad 
)
static

Extract a substring from a data buffer.

Parameters
stringThe data buffer.
stringLengthThe length of the buffer.
_positionThe position argument for the starting position.
_lengthThe substring length argument.
padThe padding argument.
Returns
The extracted substring.

Definition at line 66 of file StringUtil.cpp.

References ARG_ONE, ARG_THREE, ARG_TWO, Numerics::minVal(), optionalLengthArgument(), optionalPadArgument(), positionArgument(), RexxString::put(), raw_string(), RexxString::set(), and size_v.

Referenced by RexxString::substr(), and RexxMutableBuffer::substr().

◆ subWord()

RexxString * StringUtil::subWord ( const char *  data,
sizeB_t  length,
RexxInteger position,
RexxInteger plength 
)
static

Do a subword operation on a buffer of data

Parameters
dataThe start of the data buffer.
lengthThe length of the buffer
positionThe starting word position.
plengththe count of words to return.
Returns
The string containing the indicated subwords.

Definition at line 1505 of file StringUtil.cpp.

References ARG_ONE, ARG_TWO, Numerics::MAX_WHOLENUMBER, new_string(), nextWord(), optionalLengthArgument(), positionArgument(), sizeB_v, word(), wordLength(), and wordPos().

Referenced by RexxMutableBuffer::subWord(), and RexxString::subWord().

◆ subWords()

RexxArray * StringUtil::subWords ( const char *  data,
sizeB_t  length,
RexxInteger position,
RexxInteger plength 
)
static

Do a wordList operation on a buffer of data

Parameters
dataThe start of the data buffer.
lengthThe length of the buffer
positionThe starting word position.
plengththe count of words to return.
Returns
The array containing the indicated subwords.

Definition at line 1559 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().

◆ unpackNibble()

void StringUtil::unpackNibble ( int  Val,
char *  p 
)
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

Parameters
ValThe nibble to unpack.
pThe location to unpack into.

Definition at line 937 of file StringUtil.cpp.

Referenced by RexxString::x2b().

◆ validateSet()

size_t StringUtil::validateSet ( const char *  String,
sizeB_t  Length,
const char *  Set,
int  Modulus,
bool  Hex 
)
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.

Parameters
StringThe string to validate.
LengthThe string length.
SetThe valid characters in the set.
ModulusThe size of the smallest allowed grouping.
HexIndicates this is a hex or binary string. Used for issuing the correct error type.
Returns
The number of valid digits found.

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().

◆ valSet()

int StringUtil::valSet ( const char *  String,
sizeB_t  Length,
const char *  Set,
int  Modulus,
size_t *  PackedSize 
)
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.

Parameters
StringThe string to validate.
LengthThe string length.
SetThe validation set.
ModulusThe set modulus
PackedSizeThe final packed size.
Returns
The count of located characters.

Definition at line 993 of file StringUtil.cpp.

Referenced by dataType().

◆ verify()

RexxInteger * StringUtil::verify ( const char *  data,
sizeB_t  stringLen,
RexxString ref,
RexxString option,
RexxInteger _start,
RexxInteger range 
)
static

Perform a verify operation on a section of data.

Parameters
dataThe data pointer
stringLenThe length of the string to match
refThe reference search string.
optionThe match/nomatch option.
_startThe starting offset for the match.
Returns
The match/nomatch position, or 0 if nothing was found.

Definition at line 1420 of file StringUtil.cpp.

References ARG_FOUR, ARG_ONE, ARG_THREE, ARG_TWO, Error_Incorrect_method_option, RexxString::getBLength(), RexxString::getStringData(), IntegerZero, matchCharacter(), Numerics::minVal(), new_integer(), optionalLengthArgument(), optionalOptionArgument(), optionalPositionArgument(), reportException(), size_v, stringArgument(), VERIFY_MATCH, and VERIFY_NOMATCH.

Referenced by RexxMutableBuffer::verify(), and RexxString::verify().

◆ word()

RexxString * StringUtil::word ( const char *  data,
sizeB_t  length,
RexxInteger position 
)
static

Extract a word from a buffer

Parameters
dataThe data pointer
lengththe length of the data buffer.
positionthe target word position.
Returns
The string value of the word at the indicated position.

Definition at line 1617 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().

◆ wordCount()

size_t StringUtil::wordCount ( const char *  String,
sizeB_t  StringLength 
)
static

Count the number of words in a string.

Parameters
StringThe string to count.
StringLengthThe length of the string.
Returns
The count of white-space delimited words.

Definition at line 1282 of file StringUtil.cpp.

References skipBlanks(), skipNonBlanks(), and StringLength().

Referenced by caselessWordPos(), wordPos(), RexxMutableBuffer::words(), and RexxString::words().

◆ wordIndex()

RexxInteger * StringUtil::wordIndex ( const char *  data,
sizeB_t  length,
RexxInteger position 
)
static

Return the index position for a given word

Parameters
dataThe data containing the words
lengthThe length of the data buffer
positionThe target word position
Returns
The offset of the start of the indicated word.

Definition at line 1684 of file StringUtil.cpp.

References ARG_ONE, IntegerZero, new_integer(), nextWord(), positionArgument(), word(), wordLength(), and wordPos().

Referenced by RexxMutableBuffer::wordIndex(), and RexxString::wordIndex().

◆ wordLength()

RexxInteger * StringUtil::wordLength ( const char *  data,
sizeB_t  length,
RexxInteger position 
)
static

Return the length of the word located at a given index.

Parameters
dataThe data containing the word list.
lengthThe length of the data buffer
positionThe target word position.
Returns
The length of the given word at the target index. Returns 0 if no word is found.

Definition at line 1718 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().

◆ wordPos()

RexxInteger * StringUtil::wordPos ( const char *  data,
sizeB_t  length,
RexxString phrase,
RexxInteger pstart 
)
static

Execute a wordpos search on a buffer of data.

Parameters
datathe source data buffer.
lengththe length of the buffer
phrasethe search phrase.
pstartthe starting position.
Returns
the location of the start of the search phrase.

Definition at line 1747 of file StringUtil.cpp.

References ARG_ONE, ARG_TWO, RexxString::getBLength(), RexxString::getStringData(), IntegerZero, new_integer(), nextWord(), optionalPositionArgument(), stringArgument(), and wordCount().

Referenced by subWord(), subWords(), word(), wordIndex(), wordLength(), RexxMutableBuffer::wordPos(), and RexxString::wordPos().

◆ words()

RexxArray * StringUtil::words ( const char *  data,
sizeB_t  length 
)
static

Extract all words from a buffer

Parameters
dataThe data pointer
lengththe length of the data buffer.
positionthe target word position.
Returns
The string value of the word at the indicated position.

Definition at line 1654 of file StringUtil.cpp.

References RexxArray::append(), new_array(), new_string(), nextWord(), word(), and wordLength().

Referenced by RexxMethod::loadExternalMethod(), and RoutineClass::loadExternalRoutine().


The documentation for this class was generated from the following files: