#include <opennurbs_string.h>
Public Member Functions | |
ON_String () ON_NOEXCEPT | |
Constructors. More... | |
ON_String (const ON_String &) | |
ON_String (const char *) | |
ON_String (const char *, int) | |
ON_String (char, int=1) | |
ON_String (const unsigned char *) | |
ON_String (const unsigned char *, int) | |
ON_String (unsigned char, int=1) | |
ON_String (const wchar_t *src) | |
construct a UTF-8 string string from a UTF-16 string. More... | |
ON_String (const wchar_t *src, int length) | |
ON_String (const ON_wString &src) | |
~ON_String () | |
void | Append (const char *, int) |
string concatenation More... | |
void | Append (const unsigned char *, int) |
char * | Array () |
const char * | Array () const |
int | Compare (const ON_String &other_string, const class ON_Locale &locale, bool bIgnoreCase) const |
Compare this string and other_string by normalizing (NFC) and using invariant culture ordering. More... | |
int | Compare (const char *other_string, const class ON_Locale &locale, bool bIgnoreCase) const |
int | CompareAttributeName (const char *other_name) const |
Compare this string and other_name as a name attribute of an object like ON_3dmObjectAttributes.m_name, ON_Layer.m_name, and so on. These comparisons ignore case and use appropriate string normalization. More... | |
int | CompareOrdinal (const ON_String &other_string, bool bIgnoreCase) const |
Compare this string and other_string unsigned byte by unsigned byte. More... | |
int | CompareOrdinal (const char *other_string, bool bIgnoreCase) const |
int | ComparePath (const char *other_path) const |
Compare this string and other_path as file system paths using appropriate tests for the current operating system. More... | |
const ON_SHA1_Hash | ContentHash (ON_StringMapOrdinalType mapping) const |
void | Create () |
ON__UINT32 | DataCRC (ON__UINT32 current_remainder) const |
void | Destroy () |
void | EmergencyDestroy () |
void | Empty () |
void | EnableReferenceCounting (bool bEnable) |
Enables reference counting. I limited cases, this is useful for large strings or strings that are frequently passed around. Reference counted strings must be carefully managed in when multi-threading is used. More... | |
bool | Equal (const ON_String &other_string, const class ON_Locale &locale, bool bIgnoreCase) const |
bool | Equal (const char *other_string, const class ON_Locale &locale, bool bIgnoreCase) const |
bool | EqualAttributeName (const char *other_name) const |
bool | EqualOrdinal (const ON_String &other_string, bool bOrdinalIgnoreCase) const |
bool | EqualOrdinal (const char *other_string, bool bOrdinalIgnoreCase) const |
bool | EqualPath (const char *other_path) const |
int | Find (char utf8_single_byte_c) const |
int | Find (unsigned char utf8_single_byte_c) const |
int | Find (const char *) const |
look for a specific sub-string More... | |
int | Find (const unsigned char *) const |
int | Find (const char *, int start_index) const |
int | Find (const unsigned char *, int start_index) const |
bool ON_VARGS_FUNC_CDECL | Format (const char *format,...) |
bool ON_VARGS_FUNC_CDECL | Format (const unsigned char *format,...) |
bool | FormatVargs (const char *format, va_list args) |
bool | FormatVargs (const unsigned char *format, va_list args) |
char | GetAt (int) const |
bool | IsEmpty () const |
bool | IsNotEmpty () const |
bool | IsReferenceCounted () const |
ON_String | Left (int) const |
int | Length () const |
Attributes & Operations. More... | |
void | MakeLower () |
void | MakeLowerOrdinal () |
void | MakeReverse () |
void | MakeUpper () |
void | MakeUpperOrdinal () |
upper/lower/reverse conversion More... | |
ON_String | MapString (const class ON_Locale &locale, ON_StringMapType map_type) const |
ON_String | MapStringOrdinal (ON_StringMapOrdinalType map_type) const |
ON_String | Mid (int, int) const |
simple sub-string extraction More... | |
ON_String | Mid (int) const |
ON_DEPRECATED_MSG ("Use CompareOrdinal(), ComparePath(), CompareAttributeName(), or a test that is linguistically apprropriate") int Compare(const char *) const | |
ON_DEPRECATED_MSG ("Use CompareOrdinal(), ComparePath(), CompareAttributeName(), or a test that is linguistically apprropriate") int Compare(const unsigned char *) const | |
ON_DEPRECATED_MSG ("Use CompareOrdinal(), ComparePath(), CompareAttributeName(), or a test that is linguistically apprropriate") int CompareNoCase(const char *) const | |
ON_DEPRECATED_MSG ("Use CompareOrdinal(), ComparePath(), CompareAttributeName(), or a test that is linguistically apprropriate") int CompareNoCase(const unsigned char *) const | |
operator const char * () const | |
ON_String | operator+ (const ON_String &) const |
operator+() More... | |
ON_String | operator+ (char) const |
ON_String | operator+ (unsigned char) const |
ON_String | operator+ (const char *) const |
ON_String | operator+ (const unsigned char *) const |
const ON_String & | operator+= (const ON_String &) |
const ON_String & | operator+= (char) |
const ON_String & | operator+= (unsigned char) |
const ON_String & | operator+= (const char *) |
const ON_String & | operator+= (const unsigned char *) |
ON_String & | operator= (const ON_String &) |
overloaded assignment More... | |
ON_String & | operator= (char) |
ON_String & | operator= (const char *) |
ON_String & | operator= (unsigned char) |
ON_String & | operator= (const unsigned char *) |
ON_String & | operator= (const wchar_t *src) |
ON_String & | operator= (const ON_wString &src) |
char & | operator[] (int) |
char | operator[] (int) const |
int | Remove (const char utf8_single_byte_c) |
remove occurrences of chRemove More... | |
int | Replace (const char *token1, const char *token2) |
Replace all substrings that match token1 with token2 More... | |
int | Replace (const unsigned char *token1, const unsigned char *token2) |
int | Replace (char utf8_single_byte_c1, char utf8_single_byte_c2) |
int | Replace (unsigned char utf8_single_byte_c1, unsigned char utf8_single_byte_c2) |
char * | ReserveArray (size_t) |
Low level access to string contents as character array. More... | |
ON_String | Reverse () const |
int | ReverseFind (char utf8_single_byte_c) const |
int | ReverseFind (unsigned char utf8_single_byte_c) const |
int | ReverseFind (const char *) const |
int | ReverseFind (const unsigned char *) const |
ON_String | Right (int) const |
int ON_VARGS_FUNC_CDECL | Scan (const char *format,...) |
int ON_VARGS_FUNC_CDECL | Scan (const unsigned char *format,...) |
void | SetAt (int, char) |
void | SetAt (int, unsigned char) |
char * | SetLength (size_t) |
void | ShrinkArray () |
unsigned int | SizeOf () const |
void | TrimLeft (const char *=nullptr) |
void | TrimLeftAndRight (const char *=nullptr) |
void | TrimRight (const char *=nullptr) |
unsigned int | UnsignedLength () const |
bool | WildCardMatch (const char *) const |
Simple case sensitive wildcard matching. A question mark (?) in the pattern matches a single character. An asterisk (*) in the pattern mathes zero or more occurances of any character. More... | |
bool | WildCardMatch (const unsigned char *) const |
bool | WildCardMatchNoCase (const char *) const |
Simple case insensitive wildcard matching. A question mark (?) in the pattern matches a single character. An asterisk (*) in the pattern mathes zero or more occurances of any character. More... | |
bool | WildCardMatchNoCase (const unsigned char *) const |
Static Public Member Functions | |
static const ON_String | ApproximateFromNumber (double d) |
static int | Compare (const char *string1, const char *string2, const class ON_Locale &locale, bool bIgnoreCase) |
Compare string1 and string2 by normalizing (NFC) and using invariant culture ordering. More... | |
static int | Compare (const char *string1, int element_count1, const char *string2, int element_count2, const class ON_Locale &locale, bool bIgnoreCase) |
Compare string1 and string2 by normalizing (NFC) and using invariant culture ordering. More... | |
static int | CompareAttributeName (const char *name1, const char *name2) |
Compare this string and other_name as a name attribute of an object like ON_3dmObjectAttributes.m_name, ON_Layer.m_name, and so on. These comparisons ignore case and use appropriate string normalization. More... | |
static int | CompareOrdinal (const char *string1, const char *string2, bool bIgnoreCase) |
Compare string1 and string2 unsigned byte by unsigned byte. More... | |
static int | CompareOrdinal (const char *string1, int element_count1, const char *string2, int element_count2, bool bOrdinalIgnoreCase) |
Compare string1 and string2 unsigned byte by unsigned byte. More... | |
static int | ComparePath (const char *path1, const char *path2) |
Compare sPath1 and sPath2 as file system paths using appropriate tests for the current operating system. More... | |
static int | ComparePath (const char *path1, int element_count1, const char *path2, int element_count2) |
Compare sPath1 and sPath2 as file system paths using appropriate tests for the current operating system. More... | |
static bool | Equal (const char *string1, const char *string2, const class ON_Locale &locale, bool bIgnoreCase) |
static bool | Equal (const char *string1, int element_count1, const char *string2, int element_count2, const class ON_Locale &locale, bool bOrdinalIgnoreCase) |
static bool | EqualAttributeName (const char *name1, const char *name2) |
static bool | EqualOrdinal (const char *string1, const char *string2, bool bOrdinalIgnoreCase) |
static bool | EqualOrdinal (const char *string1, int element_count1, const char *string2, int element_count2, bool bOrdinalIgnoreCase) |
static bool | EqualPath (const char *path1, const char *path2) |
static bool | EqualPath (const char *path1, int element_count1, const char *path2, int element_count2) |
static int ON_VARGS_FUNC_CDECL | FormatIntoBuffer (char *buffer, size_t buffer_capacity, const char *format,...) |
A platform independent, secure, culture invariant way to format a char string. This function is provide to be used when it is critical that the formatting be platform independent, secure and culture invarient. More... | |
static int ON_VARGS_FUNC_CDECL | FormatIntoBuffer (ON_StringBuffer &buffer, const char *format,...) |
static const ON_wString ON_VARGS_FUNC_CDECL | FormatToString (const char *format,...) |
static int | FormatVargsIntoBuffer (char *buffer, size_t buffer_capacity, const char *format, va_list args) |
static int | FormatVargsIntoBuffer (ON_StringBuffer &buffer, const char *format, va_list args) |
static int | FormatVargsOutputCount (const char *format, va_list args) |
static const ON_String | FromNumber (char n) |
static const ON_String | FromNumber (unsigned char n) |
static const ON_String | FromNumber (short n) |
static const ON_String | FromNumber (unsigned short n) |
static const ON_String | FromNumber (int n) |
static const ON_String | FromNumber (unsigned int n) |
static const ON_String | FromNumber (ON__INT64 n) |
static const ON_String | FromNumber (ON__UINT64 n) |
static const ON_String | FromNumber (double d) |
static const ON_String | HexadecimalFromBytes (const ON__UINT8 *bytes, size_t byte_count, bool bCapitalDigits, bool bReverse) |
Each byte value is converted to 2 hexadecimal digits. More... | |
static int | Length (const char *string) |
static char | MapCharacterOrdinal (ON_StringMapOrdinalType map_type, char c) |
Map a single byte UTF-8 element to upper or lower case. More... | |
static ON_String | MapString (const class ON_Locale &locale, ON_StringMapType map_type, const char *string, int element_count) |
static int | MapString (const class ON_Locale &locale, ON_StringMapType map_type, const char *string, int element_count, char *mapped_string, int mapped_string_capacity) |
Maps element_count elements of string[] to mapped_string[]. More... | |
static int | MapStringOrdinal (ON_StringMapOrdinalType map_type, const char *string, int element_count, char *mapped_string, int mapped_string_capacity) |
Map a wchar_t string. More... | |
static const ON_String | PreciseFromNumber (double d) |
static char * | Reverse (char *string, int element_count) |
static int ON_VARGS_FUNC_CDECL | ScanBuffer (const char *buffer, const char *format,...) |
static int ON_VARGS_FUNC_CDECL | ScanBuffer (const unsigned char *buffer, const unsigned char *format,...) |
static int | ScanBufferVargs (const char *buffer, const char *format, va_list args) |
static int | ScanBufferVargs (const unsigned char *buffer, const unsigned char *format, va_list args) |
static void | SplitPath (const char *path, ON_String *drive, ON_String *dir, ON_String *fname, ON_String *ext) |
OBSOLETE - use ON_FileSystemPath::SplitPath. More... | |
static const char * | ToNumber (const char *buffer, char value_on_failure, char *value) |
static const char * | ToNumber (const char *buffer, unsigned char value_on_failure, unsigned char *value) |
static const char * | ToNumber (const char *buffer, short value_on_failure, short *value) |
static const char * | ToNumber (const char *buffer, unsigned short value_on_failure, unsigned short *value) |
static const char * | ToNumber (const char *buffer, int value_on_failure, int *value) |
static const char * | ToNumber (const char *buffer, unsigned int value_on_failure, unsigned int *value) |
static const char * | ToNumber (const char *buffer, ON__INT64 value_on_failure, ON__INT64 *value) |
static const char * | ToNumber (const char *buffer, ON__UINT64 value_on_failure, ON__UINT64 *value) |
static const char * | ToNumber (const char *buffer, double value_on_failure, double *value) |
static unsigned int | UnsignedLength (const char *string) |
Static Public Attributes | |
static const char | Backslash |
static const char | Backspace |
static const char | CarriageReturn |
static const ON_String | EmptyString |
static const char | Escape |
static const char | FormFeed |
static const char | LineFeed |
static const char | Pipe |
static const char | Slash |
static const char | Space |
static const char | Tab |
static const char | VerticalTab |
Protected Member Functions | |
void | AppendToArray (const ON_String &) |
void | AppendToArray (int, const char *) |
void | AppendToArray (int, const unsigned char *) |
void | CopyArray () |
void | CopyToArray (const ON_String &) |
void | CopyToArray (int, const char *) |
void | CopyToArray (int, const unsigned char *) |
void | CopyToArray (int, const wchar_t *) |
char * | CreateArray (int) |
struct ON_aStringHeader * | Header () const |
implementation helpers More... | |
Protected Attributes | |
char * | m_s |
Implementation. More... | |
ON_String::ON_String | ( | ) |
Constructors.
ON_String::ON_String | ( | const ON_String & | ) |
ON_String::ON_String | ( | const char * | ) |
ON_String::ON_String | ( | const char * | , |
int | |||
) |
ON_String::ON_String | ( | char | , |
int | = 1 |
||
) |
ON_String::ON_String | ( | const unsigned char * | ) |
ON_String::ON_String | ( | const unsigned char * | , |
int | |||
) |
ON_String::ON_String | ( | unsigned | char, |
int | = 1 |
||
) |
ON_String::ON_String | ( | const wchar_t * | src | ) |
construct a UTF-8 string string from a UTF-16 string.
ON_String::ON_String | ( | const wchar_t * | src, |
int | length | ||
) |
ON_String::ON_String | ( | const ON_wString & | src | ) |
ON_String::~ON_String | ( | ) |
void ON_String::Append | ( | const char * | , |
int | |||
) |
string concatenation
void ON_String::Append | ( | const unsigned char * | , |
int | |||
) |
|
protected |
|
protected |
|
protected |
|
static |
char* ON_String::Array | ( | ) |
const char* ON_String::Array | ( | ) | const |
int ON_String::Compare | ( | const ON_String & | other_string, |
const class ON_Locale & | locale, | ||
bool | bIgnoreCase | ||
) | const |
Compare this string and other_string by normalizing (NFC) and using invariant culture ordering.
other_string | [in] |
bIgnoreCase | [in] |
1) Ordinal compares are the fastest. 2) Equal(...) is faster than Compare(...)
int ON_String::Compare | ( | const char * | other_string, |
const class ON_Locale & | locale, | ||
bool | bIgnoreCase | ||
) | const |
|
static |
Compare string1 and string2 by normalizing (NFC) and using invariant culture ordering.
string1 | [in] |
string2 | [in] |
bIgnoreCase | [in] |
1) Ordinal compares are the fastest. 2) Equal(...) is faster than Compare(...)
|
static |
Compare string1 and string2 by normalizing (NFC) and using invariant culture ordering.
string1 | [in] |
element_count1 | [in] The number of string1[] elements to compare. If element_count1 < 0, then string1 must be null terminated. |
string2 | [in] |
element_count2 | [in] The number of string2[] elements to compare. If element_count2 < 0, then string2 must be null terminated. |
locale | [in] Typically ON_Locale::Ordinal, ON_Locale::InvariantCulture, or ON_Locale::CurrentCulture. |
bIgnoreCase | [in] |
1) Ordinal compares are the fastest. 2) Equal(...) is faster than Compare(...)
int ON_String::CompareAttributeName | ( | const char * | other_name | ) | const |
Compare this string and other_name as a name attribute of an object like ON_3dmObjectAttributes.m_name, ON_Layer.m_name, and so on. These comparisons ignore case and use appropriate string normalization.
other_name | [in] null terminated string |
|
static |
Compare this string and other_name as a name attribute of an object like ON_3dmObjectAttributes.m_name, ON_Layer.m_name, and so on. These comparisons ignore case and use appropriate string normalization.
name1 | [in] null terminated string |
name2 | [in] null terminated string |
int ON_String::CompareOrdinal | ( | const ON_String & | other_string, |
bool | bIgnoreCase | ||
) | const |
Compare this string and other_string unsigned byte by unsigned byte.
other_string | [in] |
bIgnoreCase | [in] |
1) If the string is UTF-8 encoded and bOrdinalIgnoreCase is true, only small latin a - z and capital latin A - Z are considered equal. It is imposible to ignore case for any other values in an ordinal compare.
2) If you are comparing file system paths, you should use ComparePath().
3) If locale, linguistic issues, UTF-8 encoding issues or unicode normalization or collation issues need to be considered, then CompareOrdinal() is the wrong function to use.
int ON_String::CompareOrdinal | ( | const char * | other_string, |
bool | bIgnoreCase | ||
) | const |
|
static |
Compare string1 and string2 unsigned byte by unsigned byte.
string1 | [in] |
string2 | [in] |
bIgnoreCase | [in] |
1) If the string is UTF-8 encoded and bOrdinalIgnoreCase is true, only small latin a - z and capital latin A - Z are considered equal. It is imposible to ignore case for any other values in a UTF-8 ordinal compare.
2) If you are comparing file system paths, you should use ComparePath().
3) If locale, linguistic issues, UTF-8 encoding issues or unicode normalization or collation issues need to be considered, then CompareOrdinal() is the wrong function to use.
|
static |
Compare string1 and string2 unsigned byte by unsigned byte.
string1 | [in] |
element_count1 | [in] The number of elements in string1[] to compare. If element_count1 < 1, string1 must be null terminated and every element before the null terminator will be compared. |
string2 | [in] |
element_count2 | [in] The number of elements in string2[] to compare. If element_count2 < 1, string2 must be null terminated and every element before the null terminator will be compared. |
bOrdinalIgnoreCase | [in] If true, elements with values a-z are compared as if they had values A-Z. |
1) If the string is UTF-8 encoded and bOrdinalIgnoreCase is true, only small latin a - z and capital latin A - Z are considered equal. It is imposible to ignore case for any other values in a UTF-8 ordinal compare.
2) If you are comparing file system paths, you should use ComparePath().
3) If locale, linguistic issues, UTF-8 encoding issues or unicode normalization or collation issues need to be considered, then CompareOrdinal() is the wrong function to use.
int ON_String::ComparePath | ( | const char * | other_path | ) | const |
Compare this string and other_path as file system paths using appropriate tests for the current operating system.
other_path | [in] |
1) Windows and UNIX directory separators (/ and ) are considered equal.
2) Case is ignored when the file system is not case sensitive, like Windows.
3) String normalization appropriate for the current operating system is performed.
|
static |
Compare sPath1 and sPath2 as file system paths using appropriate tests for the current operating system.
path1 | [in] null terminated string |
path2 | [in] null terminated string |
1) Windows and UNIX directory separators (/ and ) are considered equal.
2) Case is ignored when the file system is not case sensitive, like Windows.
3) String normalization appropriate for the current operating system is performed.
|
static |
Compare sPath1 and sPath2 as file system paths using appropriate tests for the current operating system.
path1 | [in] |
maximum_element_count1 | [in] |
path2 | [in] |
maximum_element_count2 | [in] |
1) Windows and UNIX directory separators (/ and ) are considered equal.
2) Case is ignored when the file system is not case sensitive, like Windows.
3) String normalization appropriate for the current operating system is performed.
const ON_SHA1_Hash ON_String::ContentHash | ( | ON_StringMapOrdinalType | mapping | ) | const |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
void ON_String::Create | ( | ) |
|
protected |
ON__UINT32 ON_String::DataCRC | ( | ON__UINT32 | current_remainder | ) | const |
void ON_String::Destroy | ( | ) |
void ON_String::EmergencyDestroy | ( | ) |
void ON_String::Empty | ( | ) |
void ON_String::EnableReferenceCounting | ( | bool | bEnable | ) |
Enables reference counting. I limited cases, this is useful for large strings or strings that are frequently passed around. Reference counted strings must be carefully managed in when multi-threading is used.
TODODOC: If EnableReferenceCounting() TODODOC: is not called, then the string will not be referanceThe default is to not use TODODOC: reference counted strings.
bool ON_String::Equal | ( | const ON_String & | other_string, |
const class ON_Locale & | locale, | ||
bool | bIgnoreCase | ||
) | const |
bool ON_String::Equal | ( | const char * | other_string, |
const class ON_Locale & | locale, | ||
bool | bIgnoreCase | ||
) | const |
|
static |
|
static |
bool ON_String::EqualAttributeName | ( | const char * | other_name | ) | const |
|
static |
bool ON_String::EqualOrdinal | ( | const ON_String & | other_string, |
bool | bOrdinalIgnoreCase | ||
) | const |
bool ON_String::EqualOrdinal | ( | const char * | other_string, |
bool | bOrdinalIgnoreCase | ||
) | const |
|
static |
|
static |
bool ON_String::EqualPath | ( | const char * | other_path | ) | const |
|
static |
|
static |
int ON_String::Find | ( | char | utf8_single_byte_c | ) | const |
int ON_String::Find | ( | unsigned char | utf8_single_byte_c | ) | const |
int ON_String::Find | ( | const char * | ) | const |
look for a specific sub-string
int ON_String::Find | ( | const unsigned char * | ) | const |
int ON_String::Find | ( | const char * | , |
int | start_index | ||
) | const |
int ON_String::Find | ( | const unsigned char * | , |
int | start_index | ||
) | const |
bool ON_VARGS_FUNC_CDECL ON_String::Format | ( | const char * | format, |
... | |||
) |
format | [in] Format control. Positional paramters of the form N$x where N >= 1 and x is the standard format specification are supported. Avoid using S (capital S). See the Remarks for details. ... - [in] arguments for replacable items in the format string. |
When using Microsoft's compiler and other compilers that provide similar locale support, the locale is the invariant culture locale returned by ON_Locale::InvariantCulture::LocalePtr().
The way Windows handles the S (capital S) format parameter depends on locale and code page settings. It is strongly reccommended that you never use S to include any string that may possibly contain elements with values > 127. The following examples illustrate a way to predictably use UTF-8 and wchar_t parameters in buffers of the other element type.
const char* utf8_string = ...; // UNRELIABLE // ON_wString::Format(buffer,buffer_capacity,"%S",utf8_string); // The code below will treat utf8_string as a UTF-8 encoded string. wchar_t wchar_buffer[...]; const size_t wchar_buffer_capacity= sizeof(buffer)/sizeof(buffer[0]); ON_wString::Format(wchar_buffer, wchar_buffer_capacity, "%s", ON_wString(utf8_string));
const wchar_t* wide_string = ...; // UNRELIABLE // ON_wString::Format(buffer,buffer_capacity,"%S",char_string); // The code below will include wide_string as a UTF-8 encoded string. char char_buffer[...]; const size_t char_buffer_capacity = sizeof(buffer)/sizeof(buffer[0]); ON_String::Format(char_buffer, char_buffer_capacity, "%s", ON_String(wide_string));
bool ON_VARGS_FUNC_CDECL ON_String::Format | ( | const unsigned char * | format, |
... | |||
) |
|
static |
A platform independent, secure, culture invariant way to format a char string. This function is provide to be used when it is critical that the formatting be platform independent, secure and culture invarient.
buffer | [out] not null |
buffer_capacity | [in] > 0 Number of char elements in buffer. |
sFormat | [in] Avoid using S (capital S). See the Remarks for details. ... - [in] |
The way Windows handles the S (capital S) format parameter depends on locale and code page settings. It is strongly reccommended that you never use S to include any string that may possibly contain elements with values > 127. The following examples illustrate a way to predictably use UTF-8 and wchar_t parameters in buffers of the other element type.
const char* utf8_string = ...; // UNRELIABLE // ON_wString::Format(buffer,buffer_capacity,"%S",utf8_string); wchar_t wchar_buffer[...]; const size_t wchar_buffer_capacity= sizeof(buffer)/sizeof(buffer[0]); ON_wString::Format(wchar_buffer, wchar_buffer_capacity, "%s", ON_wString(utf8_string)); const wchar_t* wide_string = ...; // UNRELIABLE // ON_wString::Format(buffer,buffer_capacity,"%S",char_string); char char_buffer[...]; const size_t char_buffer_capacity = sizeof(buffer)/sizeof(buffer[0]); ON_String::Format(char_buffer, char_buffer_capacity, "%s", ON_String(wide_string));
|
static |
|
static |
bool ON_String::FormatVargs | ( | const char * | format, |
va_list | args | ||
) |
bool ON_String::FormatVargs | ( | const unsigned char * | format, |
va_list | args | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
char ON_String::GetAt | ( | int | ) | const |
|
protected |
implementation helpers
|
static |
Each byte value is converted to 2 hexadecimal digits.
bytes | [in] list of byte values |
byte_count | [in] Number of byte values in bytes[] array. |
bCapitalDigits | [in] false: Use 0-9, a - b true: Use 0-9, A - F |
bReverse | [in] false: The digist in the string will be in the order bytes[0], bytes[1], ..., bytes[byte_count-1]. true: The digist in the string will be in the order bytes[byte_count-1], ..., bytes[1], bytes[0]. |
bool ON_String::IsEmpty | ( | ) | const |
bool ON_String::IsNotEmpty | ( | ) | const |
bool ON_String::IsReferenceCounted | ( | ) | const |
ON_String ON_String::Left | ( | int | ) | const |
int ON_String::Length | ( | ) | const |
Attributes & Operations.
|
static |
void ON_String::MakeLower | ( | ) |
void ON_String::MakeLowerOrdinal | ( | ) |
void ON_String::MakeReverse | ( | ) |
void ON_String::MakeUpper | ( | ) |
void ON_String::MakeUpperOrdinal | ( | ) |
upper/lower/reverse conversion
|
static |
Map a single byte UTF-8 element to upper or lower case.
c | [in] If c is in the range A to Z or a to z, the map specified by map_type is applied. All other values of c are unchanged. |
MapCharacterOrdinal is not appropriate for general string mapping.
|
static |
|
static |
Maps element_count elements of string[] to mapped_string[].
locale | [in] Locale to use when converting case. It is common to pass one of the preset locales ON_Locale::Ordinal, ON_Locale::InvariantCulture, or ON_Locale::m_CurrentCulture. |
map_type | [in] selects the mapping |
string | [in] input string to map. |
element_count | [in] The number of char elements to map from input string[]. |
If element_count < 1, then string[] must be null terminated and ON_wString::Length(string)+1 elements are mapped. The +1 insures the output is null terminated.
mapped_string | [out] The result of the mapping is returned in mapped_string[]. |
mapped_string_capacity | [in] Number of char elements available in mapped_string[] or 0 to calculate the minimum number of elements needed for the mapping. |
If mapped_string_capacity > 0, then the number elements set in mapped_string[] is returned.
If mapped_string_capacity == 0, then the number elements required to perform the mapping is returned.
When there is room, mapped_string[] is null terminated.
0: Failure.
ON_String ON_String::MapStringOrdinal | ( | ON_StringMapOrdinalType | map_type | ) | const |
|
static |
Map a wchar_t string.
map_type | [in] |
string | [in] |
element_count | [in] number of string[] elements to map. If element_count < 0, then ON_wString::Length(string) elements are mapped. |
mapped_string | [out] |
mapped_string_capacity | [in] number of available elements in mapped_string[]. |
map_type | [in] |
Number of mapped_string[] elements that were mapped from string[].
When the number of string[] input elements is >= mapped_string_capacity, mapped_string_capacity mapped_string[] elements are set and mapped_string_capacity is returned.
When the return value is < mapped_string_capacity, a null terminator is appended after the last mapped element.
ON_String ON_String::Mid | ( | int | , |
int | |||
) | const |
simple sub-string extraction
ON_String ON_String::Mid | ( | int | ) | const |
ON_String::ON_DEPRECATED_MSG | ( | "Use | CompareOrdinal(), |
ComparePath() | , | ||
CompareAttributeName() | , | ||
or a test that is linguistically apprropriate" | |||
) | const |
ON_String::ON_DEPRECATED_MSG | ( | "Use | CompareOrdinal(), |
ComparePath() | , | ||
CompareAttributeName() | , | ||
or a test that is linguistically apprropriate" | |||
) | const |
ON_String::ON_DEPRECATED_MSG | ( | "Use | CompareOrdinal(), |
ComparePath() | , | ||
CompareAttributeName() | , | ||
or a test that is linguistically apprropriate" | |||
) | const |
ON_String::ON_DEPRECATED_MSG | ( | "Use | CompareOrdinal(), |
ComparePath() | , | ||
CompareAttributeName() | , | ||
or a test that is linguistically apprropriate" | |||
) | const |
ON_String::operator const char * | ( | ) | const |
ON_String ON_String::operator+ | ( | char | ) | const |
ON_String ON_String::operator+ | ( | unsigned | char | ) | const |
ON_String ON_String::operator+ | ( | const char * | ) | const |
ON_String ON_String::operator+ | ( | const unsigned char * | ) | const |
const ON_String& ON_String::operator+= | ( | char | ) |
const ON_String& ON_String::operator+= | ( | unsigned | char | ) |
const ON_String& ON_String::operator+= | ( | const char * | ) |
const ON_String& ON_String::operator+= | ( | const unsigned char * | ) |
ON_String& ON_String::operator= | ( | char | ) |
ON_String& ON_String::operator= | ( | const char * | ) |
ON_String& ON_String::operator= | ( | unsigned | char | ) |
ON_String& ON_String::operator= | ( | const unsigned char * | ) |
ON_String& ON_String::operator= | ( | const wchar_t * | src | ) |
ON_String& ON_String::operator= | ( | const ON_wString & | src | ) |
char& ON_String::operator[] | ( | int | ) |
char ON_String::operator[] | ( | int | ) | const |
|
static |
int ON_String::Remove | ( | const char | utf8_single_byte_c | ) |
remove occurrences of chRemove
int ON_String::Replace | ( | const char * | token1, |
const char * | token2 | ||
) |
Replace all substrings that match token1 with token2
token1 | [in] |
token2 | [in] |
int ON_String::Replace | ( | const unsigned char * | token1, |
const unsigned char * | token2 | ||
) |
int ON_String::Replace | ( | char | utf8_single_byte_c1, |
char | utf8_single_byte_c2 | ||
) |
int ON_String::Replace | ( | unsigned char | utf8_single_byte_c1, |
unsigned char | utf8_single_byte_c2 | ||
) |
char* ON_String::ReserveArray | ( | size_t | ) |
Low level access to string contents as character array.
ON_String ON_String::Reverse | ( | ) | const |
|
static |
int ON_String::ReverseFind | ( | char | utf8_single_byte_c | ) | const |
int ON_String::ReverseFind | ( | unsigned char | utf8_single_byte_c | ) | const |
int ON_String::ReverseFind | ( | const char * | ) | const |
int ON_String::ReverseFind | ( | const unsigned char * | ) | const |
ON_String ON_String::Right | ( | int | ) | const |
int ON_VARGS_FUNC_CDECL ON_String::Scan | ( | const char * | format, |
... | |||
) |
format | [in] null terminated string to scan ... - [out] pointers to elements to assign. |
int ON_VARGS_FUNC_CDECL ON_String::Scan | ( | const unsigned char * | format, |
... | |||
) |
|
static |
|
static |
|
static |
|
static |
void ON_String::SetAt | ( | int | , |
char | |||
) |
void ON_String::SetAt | ( | int | , |
unsigned | char | ||
) |
char* ON_String::SetLength | ( | size_t | ) |
void ON_String::ShrinkArray | ( | ) |
unsigned int ON_String::SizeOf | ( | ) | const |
|
static |
OBSOLETE - use ON_FileSystemPath::SplitPath.
|
static |
buffer | [in] decimal number |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
void ON_String::TrimLeft | ( | const char * | = nullptr | ) |
void ON_String::TrimLeftAndRight | ( | const char * | = nullptr | ) |
void ON_String::TrimRight | ( | const char * | = nullptr | ) |
unsigned int ON_String::UnsignedLength | ( | ) | const |
|
static |
bool ON_String::WildCardMatch | ( | const char * | ) | const |
Simple case sensitive wildcard matching. A question mark (?) in the pattern matches a single character. An asterisk (*) in the pattern mathes zero or more occurances of any character.
pattern | [in] pattern string where ? and * are wild cards. |
bool ON_String::WildCardMatch | ( | const unsigned char * | ) | const |
bool ON_String::WildCardMatchNoCase | ( | const char * | ) | const |
Simple case insensitive wildcard matching. A question mark (?) in the pattern matches a single character. An asterisk (*) in the pattern mathes zero or more occurances of any character.
pattern | [in] pattern string where ? and * are wild cards. |
bool ON_String::WildCardMatchNoCase | ( | const unsigned char * | ) | const |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
protected |
Implementation.
|
static |
|
static |
|
static |
|
static |
|
static |