The IString class provides arrays of characters. These objects are functionally equivalent to objects of the class I0String with one major distinction: IStrings are indexed starting at 1 instead of 0. (Note that if you use an index of zero as a starting position in an IString member function, this index value is automatically converted to an index of 1.)
IString provides an operator char*. To access the actual string contained in an object of type IString, cast the assignment variable implicitly or explicitly. IString is null-terminated so that it can be cast to a char* safely. However, the terminating null is not counted in its length, and the IString can still have embedded nulls. When cast to a char*, the string is truncated at the first null encountered.
IString member functions provide the following functions beyond that available from the standard C char* arrays and the STRING.H library functions:
When a program using IString objects is run on a DBCS system, the IString objects support DBCS characters within the string contents. The various IString search functions do not accidentally match an SBCS character with the second byte of a DBCS character that has the same value. Also, IString functions that modify IString objects, such as subString, remove, and translate, never separate the two bytes of a DBCS character. If one of the two bytes of a DBCS character is removed, the remaining byte is replaced with the appropriate pad character (if the function performing the change has one) or a blank.
When working with IString objects that contain DBCS data, ensure that the contents are not altered in such a way as to corrupt the data. For example, the statement:
aString[ n ] = 'x';would be in error if the nth character of the IString was the first or second byte of a DBCS character.
IString objects are held in IBuffer objects, which allocate the area for the character arrays using the C++ operator new. The only limitation for the size of an IString are the limitations imposed by the operating system.
DBCS is equivalent to multiple-byte character set (MBCS).
To obtain locale-sensitive result for many IString operations, such as comparison, searching, editing, etc., you must enable locale-based string operation by calling IString::enableInternationalization().
To obtain locale-sensitive result for many IString operations, such as comparison, searching, editing, etc., you must enable locale-based string operation by calling IString::enableInternationalization().
Constructors & DestructorConstruct and destruct IString objects.
![]() |
public:
~IString()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
These constructors can throw exceptions under the following conditions:
Many factors dynamically allocate space and these allocation requests may fail. If so, the Open Class Library translates memory allocation errors into exceptions. Generally, such errors do not occur until you allocate an astronomical amount of storage.
These occur if you attempt to construct an IString with a length greater than UINT_MAX.
public:
IString(long aLong)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(unsigned anUnsigned)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(unsigned short anUnsignedShort)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(double aDouble)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(char aChar)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(unsigned char anUnsignedChar)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(const char* pChar)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(signed char aSignedChar)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(unsigned long anUnsignedLong)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString( const void* pBuffer1, unsigned lenBuffer1, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString( const void* pBuffer1, unsigned lenBuffer1, const void* pBuffer2, unsigned lenBuffer2, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString( const void* pBuffer1, unsigned lenBuffer1, const void* pBuffer2, unsigned lenBuffer2, const void* pBuffer3, unsigned lenBuffer3, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(const unsigned char* pUnsignedChar)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(long long aLongLong)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(unsigned long long anUnsignedLongLong)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(const IString* pIString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(const IText& anIText)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(const signed char* pSignedChar)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(short aShort)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString(int anInt)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Binary ConversionsThese members work if isBinaryDigits() == true; if not, they return a null string. The static members by the same name can be applied to a string to return the modified string without changing the argument string.
![]() |
Converts a string of binary digits to a normal string of characters. For example, this
function changes 01 to \x01 and
00110011 or 11110011 to 3.
Note:
public:
IString& b2c()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString b2c(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
static IString b2d(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& b2d()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
static IString b2x(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& b2x()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Bit OperationsUse these members to implement various public members of this class requiring bitwise operations.
![]() |
protected:
IString& applyBitOp( const char* pArg, unsigned argLen, BitOperator op )
Implements the bitwise operators &, |, and ^.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Character ConversionsThese members convert a string to binary, numeric, or hexadecimal representation. The static members by the same name can be applied to a string to return the modified string without changing the argument string. These members are used much like the similar REXX functions. For example:
aString.c2b(); // Changes aString. String binaryDigits = IString::c2b( aString ); // Leaves aString alone.
![]() |
Converts a normal string of characters to a string of
binary
digits.
For example, this function changes
"a" to 01100001 and 12 to 11000100110010
or
"a" to 10000001 and 12 to 1111000111110010.
Note:
public:
IString& c2b()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString c2b(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Converts a normal string of characters to a string of decimal digits.
For example, this function
changes
"a" to 97 and "ab" to 24930
or
"a" to 129 and "ab" to 33154.
Note:
public:
static IString c2d(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& c2d()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Converts a normal string of characters to a string of hexadecimal
digits.
For example, this function
changes
"a" to 61 and "ab" to 6162
or
"a" to 81 and "ab" to 8182.
Note:
public:
static IString c2x(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& c2x()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
DiagnosticsThese members provide IString diagnostic information for IString objects. Often, you use these members to write trace information when debugging.
![]() |
public:
IString asDebugInfo() const
Returns information about the IString's internal representation that you can use for debugging.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
IString asString() const
Returns the string itself, so that IString supports this common protocol supported by other classes in the Open Class Library.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
EditingUse these members to edit a string. All return a reference to the modified receiver. Many that are length-related, such as center and leftJustify, accept a pad character that defaults to a blank. In all cases, you can specify argument strings as either objects of the IString class or by using char*.
Static members by the same name can be applied to an IString to obtain the modified IString without affecting the argument. For example:
aString.change('\t', ' '); // Changes all tabs in aString to 3 blanks.
IString s = IString::change( aString, '\t', ' ' ); // Leaves aString as is.
![]() |
Centers the receiver within a string of the specified length.
public:
IString& center(unsigned length, char padCharacter = ' ')
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString center( const IString& aString, unsigned length, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Changes occurrences of a specified pattern to a specified replacement string. You can specify the number of changes to perform. The default is to change all occurrences of the pattern. You can also specify the position in the receiver at which to begin.
The parameters are the following:
public:
IString& change( const IString& inputString, const IString& outputString, unsigned startPos = 1, unsigned numChanges = ( unsigned ) UINT_MAX )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& change( const IString& inputString, const char* pOutputString, unsigned startPos = 1, unsigned numChanges = ( unsigned ) UINT_MAX )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString change( const IString& aString, const char* pInputString, const IString& outputString, unsigned startPos = 1, unsigned numChanges = ( unsigned ) UINT_MAX )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& change( const char* pInputString, const IString& outputString, unsigned startPos = 1, unsigned numChanges = ( unsigned ) UINT_MAX )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString change( const IString& aString, const char* pInputString, const char* pOutputString, unsigned startPos = 1, unsigned numChanges = ( unsigned ) UINT_MAX )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& change( const char* pInputString, const char* pOutputString, unsigned startPos = 1, unsigned numChanges = ( unsigned ) UINT_MAX )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString change( const IString& aString, const IString& inputString, const IString& outputString, unsigned startPos = 1, unsigned numChanges = ( unsigned ) UINT_MAX )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString change( const IString& aString, const IString& inputString, const char* pOutputString, unsigned startPos = 1, unsigned numChanges = ( unsigned ) UINT_MAX )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
protected:
IString& change( const char* pPattern, unsigned patternLen, const char* pReplacement, unsigned replacementLen, unsigned startPos, unsigned numChanges )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Replaces the receiver's contents with a specified number of replications of itself.
public:
IString& copy(unsigned numCopies)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString copy( const IString& aString, unsigned numCopies )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Inserts the specified string after the specified location.
public:
IString& insert( const IString& aString, unsigned index = 0, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& insert( const char* pString, unsigned index = 0, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString insert( const IString& aString, const IString& anInsert, unsigned index = 0, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString insert( const IString& aString, const char* pInsert, unsigned index = 0, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
protected:
IString& insert( const char* pInsert, unsigned insertLen, unsigned startPos, char padCharacter )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Left-justifies the receiver in a string of the specified length. If the new length (length) is larger than the current length, the string is extended by the pad character (padCharacter). The default pad character is a blank.
public:
IString& leftJustify( unsigned length, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString leftJustify( const IString& aString, unsigned length, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Translates all uppercase letters in the receiver to lowercase.
public:
IString& lowerCase()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString lowerCase(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Replaces a specified portion of the receiver's contents with the specified string. The overlay starts in the receiver's data at the index, which defaults to 1. If index is beyond the end of the receiver's data, it is padded with the pad character (padCharacter).
public:
IString& overlayWith( const IString& aString, unsigned index = 1, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& overlayWith( const char* pString, unsigned index = 1, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString overlayWith( const IString& aString, const IString& anOverlay, unsigned index = 1, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString overlayWith( const IString& aString, const char* pOverlay, unsigned index = 1, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
protected:
IString& overlayWith( const char* pOverlay, unsigned overlayLen, unsigned index, char padCharacter )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Deletes the specified portion of the string (that is, the substring) from the receiver. You can use this function to truncate an IString object at a specific position. For example:
aString.remove(8);removes the substring beginning at index 8 and takes the rest of the string as a default.
public:
IString& remove(unsigned startPos, unsigned numChars)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& remove(unsigned startPos)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString remove( const IString& aString, unsigned startPos )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString remove( const IString& aString, unsigned startPos, unsigned numChars )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Reverses the receiver's contents.
public:
static IString reverse(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& reverse()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Right-justifies the receiver in a string of the specified length. If the receiver's data is shorter than the requested length (length), it is padded on the left with the pad character (padCharacter). The default pad character is a blank.
public:
static IString rightJustify( const IString& aString, unsigned length, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& rightJustify( unsigned length, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Strips both the leading and trailing character or characters. You can specify the character or characters as the following:
public:
static IString strip( const IString& aString, const IString& aStringOfChars )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString strip( const IString& aString, const IStringTest& aTest )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString strip( const IString& aString, const char* pStringOfChars )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& strip(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& strip()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& strip(const IStringTest& aTest)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& strip(const char* pString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString strip(const IString& aString, char aChar)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& strip(char aCharacter)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
protected:
IString& strip( const char* pChar, unsigned len, IStringEnum::StripMode mode )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
protected:
IString& strip( const IStringTest& aTest, IStringEnum::StripMode mode )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
static IString stripBlanks(const IString& aString)
Strips both leading and trailing
white space.
Note:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Strips the leading character or characters.
public:
IString& stripLeading(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString stripLeading( const IString& aString, char aChar )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& stripLeading(const IStringTest& aTest)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& stripLeading(const char* pString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& stripLeading()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString stripLeading( const IString& aString, const IStringTest& aTest )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString stripLeading( const IString& aString, const char* pStringOfChars )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString stripLeading( const IString& aString, const IString& aStringOfChars )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& stripLeading(char aCharacter)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
static IString stripLeadingBlanks(const IString& aString)
Strips the leading character or characters.
Note:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Strips the trailing character or characters.
public:
IString& stripTrailing(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString stripTrailing( const IString& aString, const char* pStringOfChars )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString stripTrailing( const IString& aString, const IString& aStringOfChars )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& stripTrailing(const IStringTest& aTest)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString stripTrailing( const IString& aString, const IStringTest& aTest )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString stripTrailing( const IString& aString, char aChar )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& stripTrailing(const char* pString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& stripTrailing(char aCharacter)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& stripTrailing()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
static IString stripTrailingBlanks(const IString& aString)
Strips the trailing character or characters.
Note:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Converts all of the receiver's characters that are in the first specified string to the corresponding character in the second specified string.
public:
static IString translate( const IString& aString, const IString& inputChars, const IString& outputChars, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString translate( const IString& aString, const char* pInputChars, const IString& outputChars, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString translate( const IString& aString, const char* pInputChars, const char* pOutputChars, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString translate( const IString& aString, const IString& inputChars, const char* pOutputChars, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& translate( const char* pInputChars, const char* pOutputChars, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& translate( const char* pInputChars, const IString& outputChars, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& translate( const IString& inputChars, const char* pOutputChars, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& translate( const IString& inputChars, const IString& outputChars, char padCharacter = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
protected:
IString& translate( const char* pInputChars, unsigned inputLen, const char* pOutputChars, unsigned outputLen, char padCharacter )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Translates all lowercase letters in the receiver to uppercase.
public:
IString& upperCase()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString upperCase(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Forward SearchesThese members support searching a string in various ways. You can specify an optional index that indicates the search start position. The default starts at the beginning of the string.
![]() |
Returns the byte index of the first occurrence of the specified string within the receiver. If there are no occurrences, 0 is returned. In addition to IStrings, you can also specify a single character or an IStringTest.
public:
unsigned indexOf( const char* pString, unsigned startPos = 1 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned indexOf( const IString& aString, unsigned startPos = 1 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned indexOf( char aCharacter, unsigned startPos = 1 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned indexOf( const IStringTest& aTest, unsigned startPos = 1 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Returns the index of the first character of the receiver that is not in the specified set of characters. If there are no characters, 0 is returned. Alternatively, this function returns the index of the first character that fails the test prescribed by a specified IStringTest object.
public:
unsigned indexOfAnyBut( const IStringTest& aTest, unsigned startPos = 1 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned indexOfAnyBut( const char* pValidChars, unsigned startPos = 1 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned indexOfAnyBut( char validChar, unsigned startPos = 1 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned indexOfAnyBut( const IString& validChars, unsigned startPos = 1 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Returns the index of the first character of the receiver that is a character in the specified set of characters. If there are no characters, 0 is returned. Alternatively, this function returns the index of the first character that passes the test prescribed by a specified IStringTest object.
public:
unsigned indexOfAnyOf( char searchChar, unsigned startPos = 1 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned indexOfAnyOf( const IString& searchChars, unsigned startPos = 1 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned indexOfAnyOf( const char* pSearchChars, unsigned startPos = 1 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned indexOfAnyOf( const IStringTest& aTest, unsigned startPos = 1 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Returns the number of occurrences of the specified IString, char*, char, or IStringTest. If you just want a boolean test, this is slower than IString::indexOf.
public:
unsigned occurrencesOf( const IStringTest& aTest, unsigned startPos = 1 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned occurrencesOf( char aCharacter, unsigned startPos = 1 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned occurrencesOf( const char* pString, unsigned startPos = 1 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned occurrencesOf( const IString& aString, unsigned startPos = 1 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
protected:
unsigned occurrencesOf( const char* pSearchString, unsigned searchLen, unsigned startPos ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
protected:
unsigned findPhrase( const IString& aPhrase, unsigned startWord, IndexType charOrWord ) const
Locates a specified string of words for indexOfWord functions.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Hex ConversionsThese members work if isHexDigits() == true; if not, they return a NULL string. The static members by the same name can be applied to a string to return the modified string without changing the argument string.
![]() |
Converts a string of hexadecimal digits to a string of binary digits. For example, this function changes a1c to 101000011100 and f3 to 11110011.
public:
IString& x2b()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString x2b(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Converts a string of hexadecimal digits to a normal string of characters.
For example, this function
changes
8 to \x08 and 31393935 to 1995.
8 to \x08 and F1F9F9F5 to 1995.
Note:
public:
static IString x2c(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& x2c()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Converts a string of hexadecimal digits to a string of decimal digits. For example, this function changes a1c to 2588 and 10000 to 65536.
public:
static IString x2d(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& x2d()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
ImplementationUse these members to implement this class; specifically, they initialize or set the underlying IBuffer data.
![]() |
Resets the contents from a specified buffer or buffers.
protected:
IString& initBuffer(unsigned long anUnsignedLong)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
protected:
IString& initBuffer( const void* p1, unsigned len1, const void* p2 = 0, unsigned len2 = 0, const void* p3 = 0, unsigned len3 = 0, char padChar = 0 )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
protected:
IString& initBuffer(double aDouble)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
protected:
IString& initBuffer(long long aLongLong)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
protected:
IString& initBuffer(unsigned long long anUnsignedLongLong)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
protected:
IString& initBuffer(long aLong)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
protected:
IString& setBuffer(IBuffer* ibuff)
Sets the private data member to point to a new IBuffer object.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
ManipulationUse these members to manipulate a string's contents. All are overloaded so that standard C strings can be used efficiently without constructing an equivalent string first.
![]() |
Performs bitwise AND. This function can handle the following three forms:
public:
IString operator &(const char* pString) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString operator &(const IString& aString) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Performs bitwise AND and replaces the receiver. This function can handle the following two forms:
public:
IString& operator &=(const char* pString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& operator &=(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Concatenates two strings. This function can handle the following three forms:
public:
IString operator +(const char* pString) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString operator +(const IString& aString) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Concatenates the specified string to the receiver and replaces the receiver. This function can handle the following two forms:
public:
IString& operator +=(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& operator +=(const char* pString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
IString& operator =(const IString& aString)
Replaces the contents of the string.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Performs bitwise XOR. This function can handle the following three forms:
public:
IString operator ^(const char* pString) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString operator ^(const IString& aString) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Performs bitwise XOR and replaces the receiver. This function can handle the following two forms:
public:
IString& operator ^=(const char* pString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& operator ^=(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Performs bitwise OR. This function can handle the following three forms:
public:
IString operator |(const IString& aString) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString operator |(const char* pString) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Performs bitwise OR and replaces the receiver with the resulting string. This function can handle the following two forms:
public:
IString& operator |=(const char* pString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& operator |=(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
IString operator ~() const
Returns the string's bitwise negation (the string's complement).
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
NLS TestingUse these members to test the characters that comprise a string. Basically, you use these members to determine if an IString contains only characters from a specific NLS character set (SBCS, MBCS, DBCS).
![]() |
public:
static void disableInternationalization()
Disables locale-based string operations.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
static void enableInternationalization(bool enable = true)
Enables locale-based string operations.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool includesDBCS() const
If any characters are DBCS (double-byte character set), true is returned.
Note:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool includesMBCS() const
If any characters are MBCS (multiple-byte character set), true is returned.
Note:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool includesSBCS() const
If any characters are SBCS (single-byte character set), true is returned.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isDBCS() const
If all the characters are
DBCS, true is returned.
Note:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
static bool isInternationalized()
Determines if locale-based string operation is in effect.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isMBCS() const
If all the characters are MBCS, true is returned.
Note:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isSBCS() const
If all the characters are SBCS, true is returned.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isValidDBCS() const
If no
DBCS
characters have a second byte of 0, true is returned.
Note:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isValidMBCS() const
If no MBCS
characters have a second byte of 0, true is returned.
Note:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Numeric ConversionsThese members work if isDigits() == true; if not, they return a NULL string. The static members by the same name can be applied to a string to return the modified string without changing the argument string.
![]() |
Converts a string of decimal digits to a string of binary digits. This function builds the string eight bits at a time. For example,
'12' gets converted to '00001100' '17' gets converted to '00010001' '123' gets converted to '01111011'Use stripLeading('0') to strip the leading zeros.
public:
IString& d2b()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString d2b(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Converts a string of decimal digits to a normal string of characters.
For example, this function changes
12 to \x0c and 56 to 8.
12 to \x0c and 248 to 8.
Note:
public:
static IString d2c(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& d2c()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Converts a string of decimal digits to a string of hexadecimal digits. For example, this function changes 12 to c and 123 to 7b.
public:
static IString d2x(const IString& aString)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& d2x()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Pattern MatchingUse these members to determine if an object of this class contains a given pattern of characters.
![]() |
If the receiver contains the specified search string, true is returned.
public:
bool includes(const IString& aString) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
bool includes(const char* pString) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
bool includes(const IStringTest& aTest) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
bool includes(char aChar) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
If the receiver is a valid abbreviation of the specified string, true is returned.
The parameters are the following:
public:
bool isAbbreviationFor( const IString& fullString, unsigned minAbbrevLength = 0 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
bool isAbbreviationFor( const char* pFullString, unsigned minAbbrevLength = 0 ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
If the receiver matches the specified pattern, which can contain global (or wildcard) characters, true is returned. (isLike does not guarantee to return correct result for comparison between SBCS and DBCS characters.)
IString( "Allison" ).isLike( "Al*ison" ) -> true
IString( "istring7.cpp" ).isLike( "i*.?pp" ) -> true IString( "Not a question!" ).isLike( "*?", '*', '-' ) -> false
public:
bool isLike( const IString& aPattern, char zeroOrMore = ' * ', char anyChar = '?' ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
bool isLike( const char* pPattern, char zeroOrMore = ' * ', char anyChar = '?' ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
protected:
bool isLike( const char* pPattern, unsigned patternLen, char zeroOrMore, char anyChar ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
QueriesUse these members to access general information about the string.
![]() |
public:
IStringEnum::CharType charType(unsigned index) const
Returns the type of the character at the specified index.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
unsigned length() const
Returns the length of the string, not counting the terminating NULL character.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Returns a reference to the specified character of the string.
Note:
public:
char& operator [](unsigned index)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
const char& operator [](signed long index) const
| IInvalidRequest | Passed an index larger than the string size. Possible causes include boundary errors and using this function instead of the non-const version, which grows the underlying IString buffer to accommodate the index value. |
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
char& operator [](signed index)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
char& operator [](unsigned long index)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
const char& operator [](unsigned index) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
char& operator [](signed long index)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
const char& operator [](signed index) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
const char& operator [](unsigned long index) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
unsigned size() const
Returns the length of the string, not counting the terminating NULL character.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Returns a specified portion of the string (that is, the substring) of the receiver.
The parameters are the following:
aString = aString.subString(1, 7);returns the substring concluding with index 7 and discards the rest of the string.
public:
IString subString( unsigned startPos, unsigned length, char padCharacter = ' ' ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString subString(unsigned startPos) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
protected:
IBuffer* buffer() const
Returns the address of the IBuffer referred to by this IString.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
protected:
char* data() const
Returns the address of the contents of the IString.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
protected:
static char* defaultBuffer()
Returns a pointer to the contents of the nullBuffer data member.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
protected:
static unsigned lengthOf(const char* pChar)
Returns the length of a C character array.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
protected:
static const char* nullBuf()
Return the value of nullBuffer.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Reverse SearchesThese members permit searching the string in various ways. The lastIndexOf versions correspond to forward search indexOf members but start the search from the end of the string. These members return the index of the last character in the receiver IString that satisfies the search criteria. Also, they accept an optional argument that specifies where the search is to begin. The default is to start searching at the end of the string. Searching proceeds from right to left for these members.
![]() |
Returns the index of the last occurrence of the specified string or character. The search starts at the position specified by startPos (inclusive) and proceeds backward. The returned value is in the range 0 <= x <= startPos. The default of UINT_MAX starts the search at the end of the receiver's string. If the search target is not found, 0 is returned.
If you specify 1 for startPos, the search starts at the beginning of the string. Therefore, because the search proceeds backward from its starting position, in this case the search target must occur at the beginning of the string for it to be found.
public:
unsigned lastIndexOf( const IString& aString, unsigned startPos = ( unsigned ) UINT_MAX ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned lastIndexOf( char aCharacter, unsigned startPos = ( unsigned ) UINT_MAX ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned lastIndexOf( const char* pString, unsigned startPos = ( unsigned ) UINT_MAX ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned lastIndexOf( const IStringTest& aTest, unsigned startPos = ( unsigned ) UINT_MAX ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Returns the index of the last character not in the specified string or character. The search starts at the position specified by startPos (inclusive) and proceeds backward. The default of UINT_MAX starts the search at the end of the receiver's string. If the search target is not found, 0 is returned.
If you specify 1 for startPos, the search starts at the beginning of the string. Therefore, because the search proceeds backward from its starting position, in this case the search target must occur at the beginning of the string for it to be found.
public:
unsigned lastIndexOfAnyBut( const IStringTest& aTest, unsigned startPos = ( unsigned ) UINT_MAX ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned lastIndexOfAnyBut( const IString& validChars, unsigned startPos = ( unsigned ) UINT_MAX ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned lastIndexOfAnyBut( const char* pValidChars, unsigned startPos = ( unsigned ) UINT_MAX ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned lastIndexOfAnyBut( char validChar, unsigned startPos = ( unsigned ) UINT_MAX ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Returns the index of the last character in the specified string or character. The search starts at the position specified by startPos (inclusive) and proceeds backward. The default of UINT_MAX starts the search at the end of the receiver's string. If the search target is not found, 0 is returned.
If you specify 1 for startPos, the search starts at the beginning of the string. Therefore, because the search proceeds backward from its starting position, in this case the search target must occur at the beginning of the string for it to be found.
public:
unsigned lastIndexOfAnyOf( const IString& searchChars, unsigned startPos = ( unsigned ) UINT_MAX ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned lastIndexOfAnyOf( const IStringTest& aTest, unsigned startPos = ( unsigned ) UINT_MAX ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned lastIndexOfAnyOf( const char* pSearchChars, unsigned startPos = ( unsigned ) UINT_MAX ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
unsigned lastIndexOfAnyOf( char searchChar, unsigned startPos = ( unsigned ) UINT_MAX ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Stream InputUse these members to read IStrings from standard C++ streams.
![]() |
public:
static IString lineFrom( istream& aStream, char delim = '\n' )
Returns the next line from the specified input stream. This static function accepts an optional line delimiter, which defaults to \n. The resulting IString contains the characters up to the next occurrence of the delimiter. The delimiter character is skipped. If an EOF condition occurs, this function returns an IString whose contents are NULL.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Streaming SupportThese methods supoprt binary and test mode streaming of strings.
![]() |
public:
void operator <<=(IDataStream& fromWhere)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
void operator >>=(IDataStream& toWhere)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
protected:
void readFromStream(IDataStream& fromWhere)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
protected:
void writeToStream(IDataStream& toWhere) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
TestingUse these members to determine if an IString contains only characters from a predefined set.
![]() |
public:
bool isAlphabetic() const
If all the characters are in {'A'-'Z','a'-'z'}, true is returned.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isAlphanumeric() const
If all the characters are in {'A'-'Z','a'-'z','0'-'9'}, true is returned.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isASCII() const
If all the characters are in {0x00-0x7F}, true is returned.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isBinaryDigits() const
If all the characters are either 0 or 1, true is returned.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isControl() const
Returns true if all the characters are control characters. Control characters are determined using the iscntrl() C Library function defined in the cntrl locale source file and in the cntrl class of the LC_CTYPE category of the current locale. For example, on ASCII operating systems, control characters are those in the range {0x00-0x1F,0x7F}.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isDigits() const
If all the characters are in {'0'-'9'}, true is returned.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isGraphics() const
Returns true if all the characters are graphics characters.
Graphics characters are printable characters excluding the space character, as defined by the isgraph() C Library function in the graph locale source file and in the graph class of the LC_CTYPE category of the current locale. On ASCII systems, for example, graphics characters are those in the range {0x21-0x7E}.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isHexDigits() const
If all the characters are in {'0'-'9','A'-'F','a'-'f'}, true is returned.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isLowerCase() const
If all the characters are in {'a'-'z'}, true is returned.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isPrintable() const
Returns true if all the characters are printable characters. Printable characters are defined by the isprint() C Library function as defined in the print locale source file and in the print class of the LC_CTYPE category of the current locale. On ASCII systems, for example, printable characters are those in the range {0x20-0x7E}.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isPunctuation() const
If none of the characters is white space, a control character, or an alphanumeric character, true is returned.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isUpperCase() const
If all the characters are in {'A'-'Z'}, true is returned.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
bool isWhiteSpace() const
Returns true if all the characters are white-space characters. White-space characters are defined by the isspace() C Library function as defined in the space locale source file and in the space class of the LC_CTYPE category of the current locale. For example, on ASCII systems, white-space characters are those in the range {0x09-0x0D,0x20}.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
protected:
bool isAbbrevFor( const char* pFullString, unsigned fullLen, unsigned minLen ) const
If the receiver is a valid abbreviation of the specified string, true is returned.
The parameters are the following:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Type ConversionsUse these members to convert a string to various other data types. The types supported are the same set as are supported by the IString constructors.
![]() |
public:
double asDouble() const
Returns, as a double, the number that the string represents.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
long asInt() const
Returns the number that the string represents as a long integer.
If an IString is larger than the maximum integer,
this function returns the maximum integer, not the larger value.
Note:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
long long asLongLong() const
Returns the number that the string represents as a long long integer.
If an IString is larger than the maximum long long,
this function returns the maximum long long, not the larger value.
This function only exist on platforms with long long support.
Note:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
unsigned long asUnsigned() const
Returns, as an unsigned long, the integer that the string represents.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
unsigned long long asUnsignedLongLong() const
Returns, as an unsigned long long, the long long that
the string represents.
Note:
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
operator char *() const
Returns a char* pointer to the string's contents. IString is null-terminated so that it can be cast to a char* safely. However, the terminating null is not counted in its length, and the IString can still have embedded nulls. When cast to a char*, the string is truncated at the first null encountered.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
operator signed char *() const
Returns a signed char* pointer to the string's contents. IString is null-terminated so that it can be cast to a char* safely. However, the terminating null is not counted in its length, and the IString can still have embedded nulls. When cast to a char*, the string is truncated at the first null encountered.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
operator unsigned char *() const
Returns an unsigned char* pointer to the string's contents. IString is null-terminated so that it can be cast to a char* safely. However, the terminating null is not counted in its length, and the IString can still have embedded nulls. When cast to a char*, the string is truncated at the first null encountered.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Utility DataThese protected static data members provide useful values for implementing IString. IString uses the various representation of NULL and zero for initialization and comparison purposes.
![]() |
protected:
static const char * const maxLong
The maximum value of a long, with 32-bit unsigned long integers.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
This value is "2147483647" on OS/2 with 32-bit unsigned long integers.
![]() |
protected:
static const char * const null
A string that contains no element.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
protected:
static const char * const zero
The number 0.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
Word OperationsThese members operate on a string as a collection of words separated by white-space characters. They find, remove, and count words or phrases.
![]() |
public:
unsigned indexOfPhrase( const IString& wordString, unsigned startWord = 1 ) const
Returns the position of the first occurrence of the specified phrase in the receiver. If the phrase is not found, 0 is returned.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Returns the index of the specified white-space-delimited word in the receiver. If the word is not found, 0 is returned.
public:
unsigned indexOfWord(unsigned wordNumber) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
protected:
unsigned indexOfWord( unsigned wordNumber, unsigned startPos, unsigned numWords ) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
unsigned lengthOfWord(unsigned wordNumber) const
Returns the length of the specified white-space-delimited word in the receiver.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
unsigned numWords() const
Returns the number of words in the receiver.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Deletes the specified words from the receiver's contents.
You can specify the words by using a starting word number
and the number of words.
The latter defaults to the rest of the string.
Note:
public:
static IString removeWords( const IString& aString, unsigned startWord, unsigned numWords )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& removeWords(unsigned firstWord)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& removeWords(unsigned firstWord, unsigned numWords)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
static IString removeWords( const IString& aString, unsigned startWord )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Modifies the receiver so that all words are
separated by the specified number of blanks.
The default is one blank.
All
white space
is converted to simple blanks.
Note:
public:
static IString space( const IString& aString, unsigned numSpaces = 1, char spaceChar = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString& space( unsigned numSpaces = 1, char spaceChar = ' ' )
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
IString word(unsigned wordNumber) const
Returns a copy of the specified white-space-delimited word in the receiver.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
unsigned wordIndexOfPhrase( const IString& aPhrase, unsigned startWord = 1 ) const
Returns the word number of the first word in the receiver that matches the specified phrase. The function starts its search with the word number you specify in startWord, which defaults to 1. If the phrase is not found, 0 is returned.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
Returns a substring of the receiver that starts at a specified word and is comprised of a specified number of words. The word separators are copied to the result intact.
public:
IString words(unsigned firstWord, unsigned numWords) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
public:
IString words(unsigned firstWord) const
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
typedef enum { charIndex , wordIndex } IndexType
Use these enumerators to specify whether the result from the findPhrase function is a word index or a character index:
Related Enumeration
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
typedef enum { bitAnd , bitOr , bitExclusiveOr , and = bitAnd , or = bitOr , exclusiveOr = bitExclusiveOr } BitOperator
Use these enumerators to specify the bit operator to apply to the applyBitOp function. Valid bit operators are as follows:
and, or, exclusiveOr has the same value as bitAnd, bitOr, bitExclusiveOr and are slated for removal in the next release.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
bool operator !=(const char* pString1, const IString& string2)
If the strings are not bitwise identical, true is returned. This operator handles the following form of the comparison:
bool operator !=(const IString& string1, const IString& string2)
If the strings are not bitwise identical, true is returned. This operator handles the following form of the comparison:
bool operator !=(const IString& string1, const char* pString2)
If the strings are not bitwise identical, true is returned. This operator handles the following form of the comparison:
IString operator &(const char* pString, const IString& aString)
Performs bitwise AND. This operator handles the following form of the comparison:
IString operator +(const char* pString, const IString& aString)
Concatenates a null-terminated character string and the second is an IString.
bool operator <(const char* pString1, const IString& string2)
If the first string is less than the second, using the standard collating scheme (memcmp), true is returned. This operator can handles the following form of the comparison:
bool operator <(const IString& string1, const char* pString2)
If the first string is less than the second, using the standard collating scheme (memcmp), true is returned. This operator handles the following form of the comparison:
bool operator <(const IString& string1, const IString& string2)
If the first string is less than the second, using the standard collating scheme (memcmp), true is returned. This operator handles the following form of the comparison:
ostream & operator <<(ostream& aStream, const IString& aString)
Puts an IString's contents to an output stream.
bool operator <=(const IString& string1, const IString& string2)
Equivalent to (string1 < string2) || (string1 == string2). This operator handles the following form of the comparison:
bool operator <=(const IString& string1, const char* pString2)
Equivalent to (string1 < string2) || (string1 == string2). This operator handles the following form of the comparison:
bool operator <=(const char* pString1, const IString& string2)
Equivalent to (string1 < string2) || (string1 == string2). This operator can handle the following form of the comparison:
bool operator ==(const IString& string1, const char* pString2)
If the strings are bitwise identical, true is returned. This operator handles the following form of the comparison:
bool operator ==(const IString& string1, const IString& string2)
If the strings are bitwise identical, true is returned. This operator handles the following form of the comparison:
bool operator ==(const char* pString1, const IString& string2)
If the strings are bitwise identical, true is returned. This operator handles the following form of the comparison:
bool operator >(const char* pString1, const IString& string2)
Equivalent to !(string1 <= string2). This operator handles the following form of the comparison:
bool operator >(const IString& string1, const char* pString2)
Equivalent to !(string1 <= string2). This operator handles the following form of the comparison:
bool operator >(const IString& string1, const IString& string2)
Equivalent to !(string1 <= string2). This operator handles the following form of the comparison:
bool operator >=(const IString& string1, const IString& string2)
Equivalent to !(string1 < string2). This operator handles the following form of the comparison:
bool operator >=(const IString& string1, const char* pString2)
Equivalent to !(string1 < string2). This operator handles the following form of the comparison:
bool operator >=(const char* pString1, const IString& string2)
Equivalent to !(string1 < string2). This operator handles the following form of the comparison:
istream & operator >>(istream& aStream, IString& aString)
Puts the next white-space-delimited word from an input stream into an IString.
IString operator ^(const char* pString, const IString& aString)
Performs bitwise XOR. This operator handles the following form:
IString operator |(const char* pString, const IString& aString)
Performs bitwise OR. This operator handles the following form: