Links
dtSearch Text Retrieval Engine Programmer's Reference 7.70
DString Class
Classes | Legend | Members | Methods | Operators | != Operator | += Operator | << Operator | = Operator | == Operator | commaNum Method | contains Method | DString Constructor | find Method | hex Method | insert Method | replace Method | rfind Method | set Method | storeUnicodeAsAnsi Method | storeUnicodeAsUtf8 Method | urlDecode Method | Send Feedback

Simple string class for use in the dtSearch C++ Support classes and sample code.

Class Hierarchy
class DString;
File

dstring.h

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;
Group
Methods
Method 
Description 
Return the text in the DString as a COM BSTR. 
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. 
Append a string without null-termination for faster building of strings 
Store Unicode text, converting it to UTF-8, appending to an existing string 
Append text, URL-encoding it 
Append text, URL-encoding it but preserving filename characters 
Convert only A-Z to lower case 
Convert only a-z to upper case 
copy by length, potentially including null characters 
This is the overview for the commaNum method overload. 
This is the overview for the contains method overload. 
copy 
Copy another string 
Convert UTF-8 text to Unicode 
This is the overview for the DString constructor overload. 
Extend the string buffer to a minimum length 
find 
This is the overview for the find method overload. 
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 (TCHAR filename) 
Read the contents of a file into a text buffer, automatically converting UCS-16 to UTF-8 
Read the contents of a file into a text buffer, automatically converting UCS-16 to UTF-8 (UTF-8 filename) 
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) 
Returns the length of the string 
Get the size of the buffer used to store the string 
hex 
This is the overview for the hex method overload. 
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 
This is the overview for the insert method overload. 
Replace one string with another, with case-insensitive matching 
Returns true if the string does not contain any non-whitespace characters 
last 
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 
This is the overview for the replace method overload. 
This is the overview for the rfind method overload. 
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 
set 
This is the overview for the set method overload. 
Set text contents 
Extend will throw std::bad_alloc if memory is insufficient 
Store Ansi text, converting it to UTF-8 
Store either ANSI or Unicode as UTF8, depending on type of TCHAR 
This is the overview for the storeUnicodeAsAnsi method overload. 
This is the overview for the storeUnicodeAsUtf8 method overload. 
str 
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 
trim 
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) 
Try to extend the string buffer to a minimum length, and return false if unsuccessful 
This is the overview for the urlDecode method overload. 
Decode URL-encoded characters and convert to UTF-8 
URL-encode the contents of the string 
ustr 
Returns an unsigned character pointer to the internal buffer holding the string 
Convert encoding from Utf8 to Ansi 
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 
Operators
Operator 
Description 
!= 
This is the overview for the != operator overload. 
+= 
This is the overview for the += operator overload. 
<< 
This is the overview for the << operator overload. 
= 
This is the overview for the = operator overload. 
== 
This is the overview for the == operator overload. 
Returns a pointer to the internal buffer holding the string 
Legend
 
Operator 
 
Method 
 
virtual 
Links
You are here: C++ Support Classes > dtSearch Namespace > Classes > DString Class
Copyright (c) 1995-2012 dtSearch Corp. All rights reserved.