Simple string class for use in the dtSearch C++ Support classes and sample code.
File
File: dstring.h
Namespace: dtSearch
Syntax
Group
Members
Operators
Operator |
Description |
---|---|
Returns false if this string equals the other string, using strcmp | |
Returns false if this string equals the other string, using strcmp | |
Append a string | |
Append an integer to a string | |
Append a single character | |
Append a string | |
Append a double to a string | |
Append an integer to a string | |
Append an integer to a string | |
Append an integer to a string | |
Append a single unsigned character | |
Append an integer to a string | |
Append an integer to a string | |
Copy another string | |
Clear the contents of a DString and store a single character | |
Copy another string | |
Copy another string | |
Copy a Unicode string, store it as UTF-8 | |
Returns true if this string equals the other string, using strcmp | |
Returns true if this string equals the other string, using strcmp | |
Returns a pointer to the internal buffer holding the string |
Methods
Method |
Description |
---|---|
Make a DString that is a copy of another string | |
Make a DString from a buffer | |
Make a DString from a buffer keeping the text | |
Make a DString that contains specified text | |
Constructor, specifying the initial size of the string buffer | |
Make a DString that contains specified text, provided as Unicode characters | |
Return the text in the DString as a COM BSTR. The caller must free the returned value. | |
Convert encoding from Ansi to Utf8 | |
Append text to a string | |
Append a single character | |
Append without null-termination for faster building of strings | |
Append text, HTML-encoding it. If bAllowTags, then newline will be stored using a BR tag. | |
Append a string without null-termination for faster building of strings | |
Store Unicode text, converting it to UTF-8, appending to an existing string | |
Convert only A-Z to lower case | |
Convert only a-z to upper case | |
copy by length, potentially including null characters | |
Append an integer, using commas to format the number (so 12345 would be appended as 12,345) | |
Append an integer, using commas to format the number (so 12345 would be appended as 12,345) | |
Append an integer, using commas to format the number (so 12345 would be appended as 12,345) | |
Append an integer, using commas to format the number (so 12345 would be appended as 12,345) | |
Append an integer, using commas to format the number (so 12345 would be appended as 12,345) | |
Returns true if char occurs in the string | |
Returns true if substr occurs in this string | |
Copy another string | |
Find a character, starting at the front of the string | |
Find a substring, with an optional starting offset | |
Find first instance of any of the characters in a list | |
First character in the string, or null if the string is empty | |
Get character at a specified position in the string | |
Read the contents of a file into a text buffer, automatically converting UCS-16 to UTF-8 If maxToRead = -1, read the entire file | |
Read the contents of a file into a text buffer, automatically converting UCS-16 to UTF-8 (UTF-8 filename) If maxToRead = -1, read the entire file | |
Get the contents of a string returned from the dtSearch Engine as a dtsStringHandle | |
Read the contents of a file into a text buffer (UTF8 filename) If maxToRead = -1, read the entire file | |
Read the contents of a file into a text buffer (TCHAR filename) If maxToRead = -1, read the entire file | |
Returns the length of the string | |
Get the size of the buffer used to store the string | |
Append an integer formatted as a hexadecimal number without zero-padding | |
Append an integer formatted as a hexadecimal number without zero-padding | |
Append an integer formatted as a hexadecimal number without zero-padding | |
Append an integer formatted as a hexadecimal number without zero-padding | |
Append an integer formatted as a hexadecimal number without zero-padding | |
Append an integer formatted as a hexadecimal number without zero-padding | |
Append an integer formatted as a hexadecimal number without zero-padding | |
Append an integer formatted as a hexadecimal number with zero-padding | |
HTML-encode the contents of the string | |
Returns true if substr occurs in this string (case-insensitive) | |
Find a string, with case-insensitive matching | |
Insert a character at an offset | |
Insert a string at an offset | |
Replace one string with another, with case-insensitive matching | |
Returns true if the string does not contain any non-whitespace characters | |
Last character in the string, or null if the string is empty | |
Null-terminate the string | |
Fill string with a character, inserting the character in the front of the string | |
Fill string with a character | |
Remove a range of characters from a string | |
Remove all instances of a character | |
Replace one character with another | |
Replace one string with another | |
Reverse characters in place | |
Find a character, starting at the end of the string | |
Find a string, starting at the end of the string | |
Remove leading white space | |
Remove leading white space, checking for UTF-8 encoded hard spaces | |
Remove trailing white space | |
Remove trailing white space, checking for UTF-8 encoded hard spaces | |
Get an environment variable and return its value | |
Store a .NET System::String | |
Get character at a specified position in the string. | |
Set text contents | |
Extend will throw std::bad_alloc if memory is insufficient | |
Store Unicode text, converting it to Ansi | |
Store Unicode text, converting it to Ansi | |
Store Unicode text, converting it to UTF-8 | |
Store Unicode text, converting it to UTF-8 | |
Returns a pointer to the internal buffer holding the string | |
Extract a substring from a string | |
Convert to lower case | |
Convert to upper case | |
Replace one set of characters with another | |
Remove all leading and trailing whitespace | |
Truncate a string to a specified length | |
Truncate string at offset of character (not including the character) | |
Truncate string at offset of substring (not including the substring) | |
Remove beginning and ending quotation marks if either is present | |
Remove beginning and ending quotation marks if either is present | |
Remove beginning and ending quotation marks only if both are present | |
Remove beginning and ending quotation marks only if both are present | |
Returns an unsigned character pointer to the internal buffer holding the string | |
Write contents of the string to a file, using a TCHAR filename | |
Write contents of the string to a file, using a UTF-8 filename, and throw a DFileException on error | |
Write contents of the string to a file, using a UTF-8 filename |
Methods
Method |
Description |
---|---|
Make a DString that is a copy of another string | |
Make a DString from a buffer | |
Make a DString from a buffer keeping the text | |
Make a DString that contains specified text | |
Constructor, specifying the initial size of the string buffer | |
Make a DString that contains specified text, provided as Unicode characters | |
Return the text in the DString as a COM BSTR. The caller must free the returned value. | |
Convert encoding from Ansi to Utf8 | |
Append text to a string | |
Append a single character | |
Append without null-termination for faster building of strings | |
Append text, HTML-encoding it. If bAllowTags, then newline will be stored using a BR tag. | |
Append a string without null-termination for faster building of strings | |
Store Unicode text, converting it to UTF-8, appending to an existing string | |
Convert only A-Z to lower case | |
Convert only a-z to upper case | |
copy by length, potentially including null characters | |
Append an integer, using commas to format the number (so 12345 would be appended as 12,345) | |
Append an integer, using commas to format the number (so 12345 would be appended as 12,345) | |
Append an integer, using commas to format the number (so 12345 would be appended as 12,345) | |
Append an integer, using commas to format the number (so 12345 would be appended as 12,345) | |
Append an integer, using commas to format the number (so 12345 would be appended as 12,345) | |
Returns true if char occurs in the string | |
Returns true if substr occurs in this string | |
Copy another string | |
Find a character, starting at the front of the string | |
Find a substring, with an optional starting offset | |
Find first instance of any of the characters in a list | |
First character in the string, or null if the string is empty | |
Get character at a specified position in the string | |
Read the contents of a file into a text buffer, automatically converting UCS-16 to UTF-8 If maxToRead = -1, read the entire file | |
Read the contents of a file into a text buffer, automatically converting UCS-16 to UTF-8 (UTF-8 filename) If maxToRead = -1, read the entire file | |
Get the contents of a string returned from the dtSearch Engine as a dtsStringHandle | |
Read the contents of a file into a text buffer (UTF8 filename) If maxToRead = -1, read the entire file | |
Read the contents of a file into a text buffer (TCHAR filename) If maxToRead = -1, read the entire file | |
Returns the length of the string | |
Get the size of the buffer used to store the string | |
Append an integer formatted as a hexadecimal number without zero-padding | |
Append an integer formatted as a hexadecimal number without zero-padding | |
Append an integer formatted as a hexadecimal number without zero-padding | |
Append an integer formatted as a hexadecimal number without zero-padding | |
Append an integer formatted as a hexadecimal number without zero-padding | |
Append an integer formatted as a hexadecimal number without zero-padding | |
Append an integer formatted as a hexadecimal number without zero-padding | |
Append an integer formatted as a hexadecimal number with zero-padding | |
HTML-encode the contents of the string | |
Returns true if substr occurs in this string (case-insensitive) | |
Find a string, with case-insensitive matching | |
Insert a character at an offset | |
Insert a string at an offset | |
Replace one string with another, with case-insensitive matching | |
Returns true if the string does not contain any non-whitespace characters | |
Last character in the string, or null if the string is empty | |
Null-terminate the string | |
Fill string with a character, inserting the character in the front of the string | |
Fill string with a character | |
Remove a range of characters from a string | |
Remove all instances of a character | |
Replace one character with another | |
Replace one string with another | |
Reverse characters in place | |
Find a character, starting at the end of the string | |
Find a string, starting at the end of the string | |
Remove leading white space | |
Remove leading white space, checking for UTF-8 encoded hard spaces | |
Remove trailing white space | |
Remove trailing white space, checking for UTF-8 encoded hard spaces | |
Get an environment variable and return its value | |
Store a .NET System::String | |
Get character at a specified position in the string. | |
Set text contents | |
Extend will throw std::bad_alloc if memory is insufficient | |
Store Unicode text, converting it to Ansi | |
Store Unicode text, converting it to Ansi | |
Store Unicode text, converting it to UTF-8 | |
Store Unicode text, converting it to UTF-8 | |
Returns a pointer to the internal buffer holding the string | |
Extract a substring from a string | |
Convert to lower case | |
Convert to upper case | |
Replace one set of characters with another | |
Remove all leading and trailing whitespace | |
Truncate a string to a specified length | |
Truncate string at offset of character (not including the character) | |
Truncate string at offset of substring (not including the substring) | |
Remove beginning and ending quotation marks if either is present | |
Remove beginning and ending quotation marks if either is present | |
Remove beginning and ending quotation marks only if both are present | |
Remove beginning and ending quotation marks only if both are present | |
Returns an unsigned character pointer to the internal buffer holding the string | |
Write contents of the string to a file, using a TCHAR filename | |
Write contents of the string to a file, using a UTF-8 filename, and throw a DFileException on error | |
Write contents of the string to a file, using a UTF-8 filename |
Operators
Operator |
Description |
---|---|
Returns false if this string equals the other string, using strcmp | |
Returns false if this string equals the other string, using strcmp | |
Append a string | |
Append an integer to a string | |
Append a single character | |
Append a string | |
Append a double to a string | |
Append an integer to a string | |
Append an integer to a string | |
Append an integer to a string | |
Append a single unsigned character | |
Append an integer to a string | |
Append an integer to a string | |
Copy another string | |
Clear the contents of a DString and store a single character | |
Copy another string | |
Copy another string | |
Copy a Unicode string, store it as UTF-8 | |
Returns true if this string equals the other string, using strcmp | |
Returns true if this string equals the other string, using strcmp | |
Returns a pointer to the internal buffer holding the string |
Remarks
Usually the text in a DString is stored as UTF-8, although any single-byte character set can be used.
For convenience, text and numeric values can be appended to a DString using an iostreams-like syntax. Example:
DString x;
int i = 5
x << "This is some text and a number, which is " << i;
Class Hierarchy
dtSearch::DString