#include <opennurbs_string.h>

Public Member Functions

 ON_wString () ON_NOEXCEPT
 Constructors. More...
 
 ON_wString (const ON_wString &)
 
 ON_wString (const ON_String &src)
 
 ON_wString (const char *src)
 
 ON_wString (const char *src, int)
 
 ON_wString (char, int=1)
 
 ON_wString (const unsigned char *src)
 
 ON_wString (const unsigned char *src, int)
 
 ON_wString (unsigned char, int=1)
 
 ON_wString (const wchar_t *)
 
 ON_wString (const wchar_t *, int)
 
 ON_wString (wchar_t, int=1)
 
 ~ON_wString ()
 
void Append (const char *sUTF8, int)
 string concatenation More...
 
void Append (const unsigned char *sUTF8, int)
 
void Append (const wchar_t *, int)
 
wchar_t * Array ()
 
const wchar_t * Array () const
 
int Compare (const wchar_t *) const
 
int Compare (const ON_wString &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 wchar_t *other_string, const class ON_Locale &locale, bool bIgnoreCase) const
 
int CompareAttributeName (const wchar_t *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 CompareNoCase (const wchar_t *) const
 
int CompareOrdinal (const ON_wString &other_string, bool bOrdinalIgnoreCase) const
 Compare this string and other_string wchar_t element by wchar_t element. More...
 
int CompareOrdinal (const wchar_t *other_string, bool bOrdinalIgnoreCase) const
 
int ComparePath (const wchar_t *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
 
ON__UINT32 DataCRCLower (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_wString &other_string, const class ON_Locale &locale, bool bIgnoreCase) const
 
bool Equal (const wchar_t *other_string, const class ON_Locale &locale, bool bIgnoreCase) const
 
bool EqualAttributeName (const wchar_t *other_name) const
 
bool EqualOrdinal (const ON_wString &other_string, bool bOrdinalIgnoreCase) const
 
bool EqualOrdinal (const wchar_t *other_string, bool bOrdinalIgnoreCase) const
 
bool EqualPath (const wchar_t *other_path) const
 
int Find (char utf8_single_byte_c) const
 Find the first occurrence of a character or substring. More...
 
int Find (unsigned char utf8_single_byte_c) const
 
int Find (wchar_t w) const
 
int Find (const char *sUTF8) const
 
int Find (const unsigned char *sUTF8) const
 
int Find (const wchar_t *wcharString) const
 
int Find (char utf8_single_byte_c, size_t start_index) const
 
int Find (unsigned char utf8_single_byte_c, size_t start_index) const
 
int Find (wchar_t w, size_t start_index) const
 
int Find (wchar_t w, int start_index) const
 
int Find (const char *sUTF8, size_t start_index) const
 
int Find (const unsigned char *sUTF8, size_t start_index) const
 
int Find (const wchar_t *wcharString, size_t start_index) const
 
int Find (const wchar_t *wcharString, int start_index) const
 
int FindOneOf (const wchar_t *character_set) const
 
bool ON_VARGS_FUNC_CDECL Format (const wchar_t *format,...)
 
bool FormatVargs (const wchar_t *format, va_list args)
 
wchar_t GetAt (int) const
 
bool IsEmpty () const
 
bool IsNotEmpty () const
 
bool IsReferenceCounted () const
 
ON_wString Left (int) const
 
int Length () const
 Attributes & Operations. More...
 
void MakeLower ()
 
void MakeLowerOrdinal ()
 
void MakeReverse ()
 
void MakeUpper ()
 
void MakeUpperOrdinal ()
 
ON_wString MapString (const class ON_Locale &locale, ON_StringMapType map_type) const
 
ON_wString MapStringOrdinal (ON_StringMapOrdinalType map_type) const
 
ON_wString Mid (int, int) const
 simple sub-string extraction More...
 
ON_wString Mid (int) const
 
 operator const wchar_t * () const
 
ON_wString operator+ (const ON_wString &) const
 operator+() More...
 
ON_wString operator+ (const ON_String &sUTF8) const
 
ON_wString operator+ (char) const
 
ON_wString operator+ (unsigned char) const
 
ON_wString operator+ (wchar_t) const
 
ON_wString operator+ (const char *sUTF8) const
 
ON_wString operator+ (const unsigned char *sUTF8) const
 
ON_wString operator+ (const wchar_t *) const
 
const ON_wStringoperator+= (const ON_wString &)
 
const ON_wStringoperator+= (const ON_String &sUTF8)
 
const ON_wStringoperator+= (char)
 
const ON_wStringoperator+= (unsigned char)
 
const ON_wStringoperator+= (wchar_t)
 
const ON_wStringoperator+= (const char *sUTF8)
 
const ON_wStringoperator+= (const unsigned char *sUTF8)
 
const ON_wStringoperator+= (const wchar_t *)
 
const ON_wStringoperator= (const ON_wString &)
 overloaded assignment More...
 
const ON_wStringoperator= (const ON_String &src)
 
const ON_wStringoperator= (char)
 
const ON_wStringoperator= (const char *src)
 
const ON_wStringoperator= (unsigned char)
 
const ON_wStringoperator= (const unsigned char *src)
 
const ON_wStringoperator= (wchar_t)
 
const ON_wStringoperator= (const wchar_t *)
 
wchar_t & operator[] (int)
 
wchar_t operator[] (int) const
 
int Remove (char utf8_single_byte_c)
 Remove all occurrences of the input character. More...
 
int Remove (unsigned char utf8_single_byte_c)
 
int Remove (wchar_t w)
 
const ON_wString RemovePrefix (const wchar_t *prefix, const class ON_Locale &locale, bool bIgnoreCase) const
 
const ON_wString RemoveSuffix (const wchar_t *suffix, const class ON_Locale &locale, bool bIgnoreCase) const
 
int RemoveWhiteSpace (const wchar_t *whitespace=0)
 Removes all white-space characters with the token. More...
 
int Replace (const wchar_t *token1, const wchar_t *token2)
 Replace all substrings that match token1 with token2 More...
 
int Replace (wchar_t token1, wchar_t token2)
 
int ReplaceWhiteSpace (wchar_t token, const wchar_t *whitespace=0)
 Replace all white-space characters with the token. If token is zero, the string will end up with internal 0's More...
 
wchar_t * ReserveArray (size_t)
 Low level access to string contents as character array. More...
 
ON_wString Reverse () const
 upper/lower/reverse conversion More...
 
int ReverseFind (char utf8_single_byte_c) const
 Find the last occurrence of a character or substring. More...
 
int ReverseFind (unsigned char utf8_single_byte_c) const
 
int ReverseFind (wchar_t w) const
 
int ReverseFind (const char *sUTF8) const
 
int ReverseFind (const wchar_t *wideString) const
 
ON_wString Right (int) const
 
int ON_VARGS_FUNC_CDECL Scan (const wchar_t *format,...) const
 
void SetAt (int, char)
 
void SetAt (int, unsigned char)
 
void SetAt (int, wchar_t)
 
wchar_t * SetLength (size_t)
 
void ShrinkArray ()
 
unsigned int SizeOf () const
 
const ON_wString SubString (int start_index) const
 
const ON_wString SubString (int start_index, int count) const
 
void TrimLeft (const wchar_t *s=nullptr)
 Removes leading elements from the string. More...
 
void TrimLeftAndRight (const wchar_t *s=nullptr)
 
void TrimRight (const wchar_t *s=nullptr)
 Removes trailing elements from the string. More...
 
unsigned int UnsignedLength () const
 
bool UrlDecode ()
 Replaces all xx where xx a two digit hexadecimal number, with a single character. Returns false if the orginal string contained More...
 
void UrlEncode ()
 Replaces all characters in the string whose values are not '0-9', 'A-Z', or 'a-z' with a percent sign followed by a 2 digit hex value. More...
 
bool WildCardMatch (const wchar_t *) 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 WildCardMatchNoCase (const wchar_t *) 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...
 

Static Public Member Functions

static const ON_wString ApproximateFromNumber (double d)
 
static int Compare (const wchar_t *string1, const wchar_t *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 wchar_t *string1, int element_count1, const wchar_t *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 wchar_t *name1, const wchar_t *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 wchar_t *string1, const wchar_t *string2, bool bOrdinalIgnoreCase)
 Compare this string1 and string2 wchar_t element by wchar_t element. More...
 
static int CompareOrdinal (const wchar_t *string1, int element_count1, const wchar_t *string2, int element_count2, bool bOrdinalIgnoreCase)
 Compare this string1 and string2 wchar_t element by wchar_t element. More...
 
static int ComparePath (const wchar_t *path1, const wchar_t *path2)
 Compare sPath1 and sPath2 as file system paths using appropriate tests for the current operating system. More...
 
static int ComparePath (const wchar_t *path1, int element_count1, const wchar_t *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 wchar_t *string1, const wchar_t *string2, const class ON_Locale &locale, bool bIgnoreCase)
 
static bool Equal (const wchar_t *string1, int element_count1, const wchar_t *string2, int element_count2, const class ON_Locale &locale, bool bIgnoreCase)
 Determine if string 1 and string2 are equal. More...
 
static bool EqualAttributeName (const wchar_t *name1, const wchar_t *name2)
 
static bool EqualOrdinal (const wchar_t *string1, const wchar_t *string2, bool bOrdinalIgnoreCase)
 
static bool EqualOrdinal (const wchar_t *string1, int element_count1, const wchar_t *string2, int element_count2, bool bOrdinalIgnoreCase)
 
static bool EqualPath (const wchar_t *path1, const wchar_t *path2)
 
static bool EqualPath (const wchar_t *path1, int element_count1, const wchar_t *path2, int element_count2)
 
static int ON_VARGS_FUNC_CDECL FormatIntoBuffer (wchar_t *buffer, size_t buffer_capacity, const wchar_t *format,...)
 A platform independent, secure, culture invariant way to format a wchar_t string with support for positional format parameters. 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_wStringBuffer &buffer, const wchar_t *format,...)
 
static const ON_wString ON_VARGS_FUNC_CDECL FormatToString (const wchar_t *format,...)
 
static int FormatVargsIntoBuffer (ON_wStringBuffer &buffer, const wchar_t *format, va_list args)
 
static int FormatVargsIntoBuffer (wchar_t *buffer, size_t buffer_capacity, const wchar_t *format, va_list args)
 
static int FormatVargsOutputCount (const wchar_t *format, va_list args)
 
static const ON_wString FromNumber (char n)
 
static const ON_wString FromNumber (unsigned char n)
 
static const ON_wString FromNumber (short n)
 
static const ON_wString FromNumber (unsigned short n)
 
static const ON_wString FromNumber (int n)
 
static const ON_wString FromNumber (unsigned int n)
 
static const ON_wString FromNumber (ON__INT64 n)
 
static const ON_wString FromNumber (ON__UINT64 n)
 
static const ON_wString FromNumber (double d)
 
static const ON_wString FromUnicodeCodePoints (const ON__UINT32 *code_points, int code_point_count, ON__UINT32 error_code_point)
 Convert a list of Unicode code points into a wide string. More...
 
static const ON_wString 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 wchar_t *string)
 
static wchar_t MapCharacterOrdinal (ON_StringMapOrdinalType map_type, wchar_t c)
 Map a single wchar_t element to upper or lower case. More...
 
static ON_wString MapString (const class ON_Locale &locale, ON_StringMapType map_type, const wchar_t *string, int element_count)
 
static int MapString (const class ON_Locale &locale, ON_StringMapType map_type, const wchar_t *string, int element_count, wchar_t *mapped_string, int mapped_string_capacity)
 Maps element_count elements of string[] to mapped_string[]. More...
 
static int MapStringOrdinal (ON_StringMapOrdinalType map_type, const wchar_t *string, int element_count, wchar_t *mapped_string, int mapped_string_capacity)
 Map a wchar_t string. More...
 
static const ON_wString PreciseFromNumber (double d)
 
static wchar_t * Reverse (wchar_t *string, int element_count)
 
static int ON_VARGS_FUNC_CDECL ScanBuffer (const wchar_t *buffer, const wchar_t *format,...)
 
static int ScanBufferVargs (const wchar_t *buffer, const wchar_t *format, va_list args)
 
static void SplitPath (const char *path, ON_wString *drive, ON_wString *dir, ON_wString *fname, ON_wString *ext)
 OBSOLETE - Use ON_FileSystemPath::SplitPath. More...
 
static void SplitPath (const wchar_t *path, ON_wString *drive, ON_wString *dir, ON_wString *fname, ON_wString *ext)
 
static const wchar_t * ToNumber (const wchar_t *buffer, char value_on_failure, char *value)
 
static const wchar_t * ToNumber (const wchar_t *buffer, unsigned char value_on_failure, unsigned char *value)
 
static const wchar_t * ToNumber (const wchar_t *buffer, short value_on_failure, short *value)
 
static const wchar_t * ToNumber (const wchar_t *buffer, unsigned short value_on_failure, unsigned short *value)
 
static const wchar_t * ToNumber (const wchar_t *buffer, int value_on_failure, int *value)
 
static const wchar_t * ToNumber (const wchar_t *buffer, unsigned int value_on_failure, unsigned int *value)
 
static const wchar_t * ToNumber (const wchar_t *buffer, ON__INT64 value_on_failure, ON__INT64 *value)
 
static const wchar_t * ToNumber (const wchar_t *buffer, ON__UINT64 value_on_failure, ON__UINT64 *value)
 
static const wchar_t * ToNumber (const wchar_t *buffer, double value_on_failure, double *value)
 
static unsigned int UnsignedLength (const wchar_t *string)
 

Static Public Attributes

static const wchar_t Backslash
 
static const wchar_t Backspace
 
static const wchar_t CarriageReturn
 
static const ON_wString EmptyString
 
static const wchar_t Escape
 
static const wchar_t FormFeed
 
static const wchar_t LineFeed
 
static const wchar_t Pipe
 
static const wchar_t Slash
 
static const wchar_t Space
 
static const wchar_t Tab
 
static const wchar_t VerticalTab
 

Protected Member Functions

void AppendToArray (const ON_wString &)
 
void AppendToArray (int, const char *)
 
void AppendToArray (int, const unsigned char *)
 
void AppendToArray (int, const wchar_t *)
 
void CopyArray ()
 
void CopyToArray (const ON_wString &)
 
void CopyToArray (int, const char *)
 
void CopyToArray (int, const unsigned char *)
 
void CopyToArray (int, const wchar_t *)
 
wchar_t * CreateArray (int)
 
struct ON_wStringHeader * Header () const
 implementation helpers More...
 

Protected Attributes

wchar_t * m_s
 Implementation. More...
 

Constructor & Destructor Documentation

◆ ON_wString() [1/12]

ON_wString::ON_wString ( )

Constructors.

◆ ON_wString() [2/12]

ON_wString::ON_wString ( const ON_wString )

◆ ON_wString() [3/12]

ON_wString::ON_wString ( const ON_String src)

◆ ON_wString() [4/12]

ON_wString::ON_wString ( const char *  src)

◆ ON_wString() [5/12]

ON_wString::ON_wString ( const char *  src,
int   
)

◆ ON_wString() [6/12]

ON_wString::ON_wString ( char  ,
int  = 1 
)

◆ ON_wString() [7/12]

ON_wString::ON_wString ( const unsigned char *  src)

◆ ON_wString() [8/12]

ON_wString::ON_wString ( const unsigned char *  src,
int   
)

◆ ON_wString() [9/12]

ON_wString::ON_wString ( unsigned  char,
int  = 1 
)

◆ ON_wString() [10/12]

ON_wString::ON_wString ( const wchar_t *  )

◆ ON_wString() [11/12]

ON_wString::ON_wString ( const wchar_t *  ,
int   
)

◆ ON_wString() [12/12]

ON_wString::ON_wString ( wchar_t  ,
int  = 1 
)

◆ ~ON_wString()

ON_wString::~ON_wString ( )

Member Function Documentation

◆ Append() [1/3]

void ON_wString::Append ( const char *  sUTF8,
int   
)

string concatenation

◆ Append() [2/3]

void ON_wString::Append ( const unsigned char *  sUTF8,
int   
)

◆ Append() [3/3]

void ON_wString::Append ( const wchar_t *  ,
int   
)

◆ AppendToArray() [1/4]

void ON_wString::AppendToArray ( const ON_wString )
protected

◆ AppendToArray() [2/4]

void ON_wString::AppendToArray ( int  ,
const char *   
)
protected

◆ AppendToArray() [3/4]

void ON_wString::AppendToArray ( int  ,
const unsigned char *   
)
protected

◆ AppendToArray() [4/4]

void ON_wString::AppendToArray ( int  ,
const wchar_t *   
)
protected

◆ ApproximateFromNumber()

static const ON_wString ON_wString::ApproximateFromNumber ( double  d)
static

◆ Array() [1/2]

wchar_t* ON_wString::Array ( )

◆ Array() [2/2]

const wchar_t* ON_wString::Array ( ) const

◆ Compare() [1/5]

int ON_wString::Compare ( const wchar_t *  ) const

◆ Compare() [2/5]

int ON_wString::Compare ( const ON_wString other_string,
const class ON_Locale locale,
bool  bIgnoreCase 
) const

Compare this string and other_string by normalizing (NFC) and using invariant culture ordering.

Parameters
other_string[in]
bIgnoreCase[in]

1) Ordinal compares are the fastest. 2) Equal(...) is faster than Compare(...)

◆ Compare() [3/5]

int ON_wString::Compare ( const wchar_t *  other_string,
const class ON_Locale locale,
bool  bIgnoreCase 
) const

◆ Compare() [4/5]

static int ON_wString::Compare ( const wchar_t *  string1,
const wchar_t *  string2,
const class ON_Locale locale,
bool  bIgnoreCase 
)
static

Compare string1 and string2 by normalizing (NFC) and using invariant culture ordering.

Parameters
string1[in]
string2[in]
bIgnoreCase[in]

1) Ordinal compares are the fastest. 2) Equal(...) is faster than Compare(...)

◆ Compare() [5/5]

static int ON_wString::Compare ( const wchar_t *  string1,
int  element_count1,
const wchar_t *  string2,
int  element_count2,
const class ON_Locale locale,
bool  bIgnoreCase 
)
static

Compare string1 and string2 by normalizing (NFC) and using invariant culture ordering.

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

◆ CompareAttributeName() [1/2]

int ON_wString::CompareAttributeName ( const wchar_t *  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.

Parameters
other_name[in] null terminated string

◆ CompareAttributeName() [2/2]

static int ON_wString::CompareAttributeName ( const wchar_t *  name1,
const wchar_t *  name2 
)
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.

Parameters
name1[in] null terminated string
name2[in] null terminated string

◆ CompareNoCase()

int ON_wString::CompareNoCase ( const wchar_t *  ) const

◆ CompareOrdinal() [1/4]

int ON_wString::CompareOrdinal ( const ON_wString other_string,
bool  bOrdinalIgnoreCase 
) const

Compare this string and other_string wchar_t element by wchar_t element.

Parameters
other_string[in]
bOrdinalIgnoreCase[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.

◆ CompareOrdinal() [2/4]

int ON_wString::CompareOrdinal ( const wchar_t *  other_string,
bool  bOrdinalIgnoreCase 
) const

◆ CompareOrdinal() [3/4]

static int ON_wString::CompareOrdinal ( const wchar_t *  string1,
const wchar_t *  string2,
bool  bOrdinalIgnoreCase 
)
static

Compare this string1 and string2 wchar_t element by wchar_t element.

Parameters
string1[in]
string2[in]
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 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.

◆ CompareOrdinal() [4/4]

static int ON_wString::CompareOrdinal ( const wchar_t *  string1,
int  element_count1,
const wchar_t *  string2,
int  element_count2,
bool  bOrdinalIgnoreCase 
)
static

Compare this string1 and string2 wchar_t element by wchar_t element.

Parameters
string1[in]
maximum_element_count1[in] maximum number of elements to compare
string2[in]
maximum_element_count2[in] maximum number of elements to compare
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 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.

◆ ComparePath() [1/3]

int ON_wString::ComparePath ( const wchar_t *  other_path) const

Compare this string and other_path as file system paths using appropriate tests for the current operating system.

Parameters
other_path[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.

◆ ComparePath() [2/3]

static int ON_wString::ComparePath ( const wchar_t *  path1,
const wchar_t *  path2 
)
static

Compare sPath1 and sPath2 as file system paths using appropriate tests for the current operating system.

Parameters
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.

◆ ComparePath() [3/3]

static int ON_wString::ComparePath ( const wchar_t *  path1,
int  element_count1,
const wchar_t *  path2,
int  element_count2 
)
static

Compare sPath1 and sPath2 as file system paths using appropriate tests for the current operating system.

Parameters
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.

◆ ContentHash()

const ON_SHA1_Hash ON_wString::ContentHash ( ON_StringMapOrdinalType  mapping) const
Returns
A platform independed SHA-1 of the string content. Independent of platform endian or platform wide string UTF encoding.

◆ CopyArray()

void ON_wString::CopyArray ( )
protected

◆ CopyToArray() [1/4]

void ON_wString::CopyToArray ( const ON_wString )
protected

◆ CopyToArray() [2/4]

void ON_wString::CopyToArray ( int  ,
const char *   
)
protected

◆ CopyToArray() [3/4]

void ON_wString::CopyToArray ( int  ,
const unsigned char *   
)
protected

◆ CopyToArray() [4/4]

void ON_wString::CopyToArray ( int  ,
const wchar_t *   
)
protected

◆ Create()

void ON_wString::Create ( )

◆ CreateArray()

wchar_t* ON_wString::CreateArray ( int  )
protected

◆ DataCRC()

ON__UINT32 ON_wString::DataCRC ( ON__UINT32  current_remainder) const
Returns
CRC of the string.

◆ DataCRCLower()

ON__UINT32 ON_wString::DataCRCLower ( ON__UINT32  current_remainder) const
Returns
CRC of the lower case version of the string. Useful for case insensitive CRCs and hash codes.

◆ Destroy()

void ON_wString::Destroy ( )

◆ EmergencyDestroy()

void ON_wString::EmergencyDestroy ( )

◆ Empty()

void ON_wString::Empty ( )

◆ EnableReferenceCounting()

void ON_wString::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.

◆ Equal() [1/4]

bool ON_wString::Equal ( const ON_wString other_string,
const class ON_Locale locale,
bool  bIgnoreCase 
) const

◆ Equal() [2/4]

bool ON_wString::Equal ( const wchar_t *  other_string,
const class ON_Locale locale,
bool  bIgnoreCase 
) const

◆ Equal() [3/4]

static bool ON_wString::Equal ( const wchar_t *  string1,
const wchar_t *  string2,
const class ON_Locale locale,
bool  bIgnoreCase 
)
static

◆ Equal() [4/4]

static bool ON_wString::Equal ( const wchar_t *  string1,
int  element_count1,
const wchar_t *  string2,
int  element_count2,
const class ON_Locale locale,
bool  bIgnoreCase 
)
static

Determine if string 1 and string2 are equal.

Parameters
string1[in]
element_count1[in] The number of string1[] elements to test. If element_count1 < 0, then string1 must nullptr or be null terminated.
string2[in]
element_count2[in] The number of string2[] elements to test. If element_count1 < 0, then string2 must nullptr or 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(...)

◆ EqualAttributeName() [1/2]

bool ON_wString::EqualAttributeName ( const wchar_t *  other_name) const

◆ EqualAttributeName() [2/2]

static bool ON_wString::EqualAttributeName ( const wchar_t *  name1,
const wchar_t *  name2 
)
static

◆ EqualOrdinal() [1/4]

bool ON_wString::EqualOrdinal ( const ON_wString other_string,
bool  bOrdinalIgnoreCase 
) const

◆ EqualOrdinal() [2/4]

bool ON_wString::EqualOrdinal ( const wchar_t *  other_string,
bool  bOrdinalIgnoreCase 
) const

◆ EqualOrdinal() [3/4]

static bool ON_wString::EqualOrdinal ( const wchar_t *  string1,
const wchar_t *  string2,
bool  bOrdinalIgnoreCase 
)
static

◆ EqualOrdinal() [4/4]

static bool ON_wString::EqualOrdinal ( const wchar_t *  string1,
int  element_count1,
const wchar_t *  string2,
int  element_count2,
bool  bOrdinalIgnoreCase 
)
static

◆ EqualPath() [1/3]

bool ON_wString::EqualPath ( const wchar_t *  other_path) const

◆ EqualPath() [2/3]

static bool ON_wString::EqualPath ( const wchar_t *  path1,
const wchar_t *  path2 
)
static

◆ EqualPath() [3/3]

static bool ON_wString::EqualPath ( const wchar_t *  path1,
int  element_count1,
const wchar_t *  path2,
int  element_count2 
)
static

◆ Find() [1/14]

int ON_wString::Find ( char  utf8_single_byte_c) const

Find the first occurrence of a character or substring.

Parameters
utf8_single_byte_c[in] utf8_single_byte_c must have a value between 0 and 0x7F.
w[in] When w is a 2 byte UTF-16 wchar_t value (like Microsoft's wchar_t), it must be in the range 0 to 0xD7FF or 0xE000 to 0xFFFF. When w is a 4 byte UTF-32 wchar_t value (like Apple's wchar_t), it must be in the range 0 to 0xD7FF or 0xE000 to 0x10FFFF.
sTUF8[in] A null terminated UTF-8 string.
wcharString[in] A null terminated wchar_t string.
start_index[in] Index where search should begin.
Returns
-1: invalid input or character is not in the string. >=0: Index of the first instance of the character.

◆ Find() [2/14]

int ON_wString::Find ( unsigned char  utf8_single_byte_c) const

◆ Find() [3/14]

int ON_wString::Find ( wchar_t  w) const

◆ Find() [4/14]

int ON_wString::Find ( const char *  sUTF8) const

◆ Find() [5/14]

int ON_wString::Find ( const unsigned char *  sUTF8) const

◆ Find() [6/14]

int ON_wString::Find ( const wchar_t *  wcharString) const

◆ Find() [7/14]

int ON_wString::Find ( char  utf8_single_byte_c,
size_t  start_index 
) const

◆ Find() [8/14]

int ON_wString::Find ( unsigned char  utf8_single_byte_c,
size_t  start_index 
) const

◆ Find() [9/14]

int ON_wString::Find ( wchar_t  w,
size_t  start_index 
) const

◆ Find() [10/14]

int ON_wString::Find ( wchar_t  w,
int  start_index 
) const

◆ Find() [11/14]

int ON_wString::Find ( const char *  sUTF8,
size_t  start_index 
) const

◆ Find() [12/14]

int ON_wString::Find ( const unsigned char *  sUTF8,
size_t  start_index 
) const

◆ Find() [13/14]

int ON_wString::Find ( const wchar_t *  wcharString,
size_t  start_index 
) const

◆ Find() [14/14]

int ON_wString::Find ( const wchar_t *  wcharString,
int  start_index 
) const

◆ FindOneOf()

int ON_wString::FindOneOf ( const wchar_t *  character_set) const

◆ Format()

bool ON_VARGS_FUNC_CDECL ON_wString::Format ( const wchar_t *  format,
  ... 
)
Parameters
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.
Returns
True if successful. False if the string is too long or the format string is not valid.

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));

◆ FormatIntoBuffer() [1/2]

static int ON_VARGS_FUNC_CDECL ON_wString::FormatIntoBuffer ( wchar_t *  buffer,
size_t  buffer_capacity,
const wchar_t *  format,
  ... 
)
static

A platform independent, secure, culture invariant way to format a wchar_t string with support for positional format parameters. This function is provide to be used when it is critical that the formatting be platform independent, secure and culture invarient.

Parameters
buffer[out] not null
buffer_capacity[in] > 0 Number of wchar_t elements in buffer.
format[in] Avoid using S (capital S). See the Remarks for details. ... - [in]
Returns
>= 0: The number of wchar_t elements written to buffer[], not including the null terminator. A null terminator is always added (buffer[returned value] = 0). The last element of buffer[] is always set to zero (buffer[buffer_capacity-1] = 0). < 0: failure: If buffer is not null and buffer_capacity > 0, then buffer[0] = 0 and buffer[buffer_capacity-1] = 0;

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));

◆ FormatIntoBuffer() [2/2]

static int ON_VARGS_FUNC_CDECL ON_wString::FormatIntoBuffer ( ON_wStringBuffer buffer,
const wchar_t *  format,
  ... 
)
static

◆ FormatToString()

static const ON_wString ON_VARGS_FUNC_CDECL ON_wString::FormatToString ( const wchar_t *  format,
  ... 
)
static

◆ FormatVargs()

bool ON_wString::FormatVargs ( const wchar_t *  format,
va_list  args 
)

◆ FormatVargsIntoBuffer() [1/2]

static int ON_wString::FormatVargsIntoBuffer ( ON_wStringBuffer buffer,
const wchar_t *  format,
va_list  args 
)
static

◆ FormatVargsIntoBuffer() [2/2]

static int ON_wString::FormatVargsIntoBuffer ( wchar_t *  buffer,
size_t  buffer_capacity,
const wchar_t *  format,
va_list  args 
)
static

◆ FormatVargsOutputCount()

static int ON_wString::FormatVargsOutputCount ( const wchar_t *  format,
va_list  args 
)
static
Returns
>= 0: Number of char elements in the formatted string, not including the null terminator. < 0: Invalid input

◆ FromNumber() [1/9]

static const ON_wString ON_wString::FromNumber ( char  n)
static

◆ FromNumber() [2/9]

static const ON_wString ON_wString::FromNumber ( unsigned char  n)
static

◆ FromNumber() [3/9]

static const ON_wString ON_wString::FromNumber ( short  n)
static

◆ FromNumber() [4/9]

static const ON_wString ON_wString::FromNumber ( unsigned short  n)
static

◆ FromNumber() [5/9]

static const ON_wString ON_wString::FromNumber ( int  n)
static

◆ FromNumber() [6/9]

static const ON_wString ON_wString::FromNumber ( unsigned int  n)
static

◆ FromNumber() [7/9]

static const ON_wString ON_wString::FromNumber ( ON__INT64  n)
static

◆ FromNumber() [8/9]

static const ON_wString ON_wString::FromNumber ( ON__UINT64  n)
static

◆ FromNumber() [9/9]

static const ON_wString ON_wString::FromNumber ( double  d)
static

◆ FromUnicodeCodePoints()

static const ON_wString ON_wString::FromUnicodeCodePoints ( const ON__UINT32 *  code_points,
int  code_point_count,
ON__UINT32  error_code_point 
)
static

Convert a list of Unicode code points into a wide string.

Parameters
code_points[in] array of Unicode code points
code_point_count[in] number of code points. -1 indicates code_points[] is terminated by a 0 value.
error_code_point[in] If error_code_point is a valid Unicode code point, then error_code_point will be used in place of invalid values in code_points[]. Otherwise, conversion will terminate if code_points[] contains an invalid value. The values ON_UnicodeCodePoint::ON_ReplacementCharacter and ON_UnicodeCodePoint::ON_InvalidCodePoint are commonly used for this parameter.
Returns
A wide string encoding of the Unicode code points.

If more control over the conversion process is required, then use ON_ConvertUTF32ToWideChar().

◆ GetAt()

wchar_t ON_wString::GetAt ( int  ) const

◆ Header()

struct ON_wStringHeader* ON_wString::Header ( ) const
protected

implementation helpers

◆ HexadecimalFromBytes()

static const ON_wString ON_wString::HexadecimalFromBytes ( const ON__UINT8 *  bytes,
size_t  byte_count,
bool  bCapitalDigits,
bool  bReverse 
)
static

Each byte value is converted to 2 hexadecimal digits.

Parameters
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].

◆ IsEmpty()

bool ON_wString::IsEmpty ( ) const

◆ IsNotEmpty()

bool ON_wString::IsNotEmpty ( ) const

◆ IsReferenceCounted()

bool ON_wString::IsReferenceCounted ( ) const
Returns
True if the string is reference counted.

◆ Left()

ON_wString ON_wString::Left ( int  ) const

◆ Length() [1/2]

int ON_wString::Length ( ) const

Attributes & Operations.

Returns
number of nonzero elements in string.

◆ Length() [2/2]

static int ON_wString::Length ( const wchar_t *  string)
static
Returns
number of nonzero elements in string before the first null terminator. If string is nullptr, 0 is returned.

◆ MakeLower()

void ON_wString::MakeLower ( )

◆ MakeLowerOrdinal()

void ON_wString::MakeLowerOrdinal ( )

◆ MakeReverse()

void ON_wString::MakeReverse ( )

◆ MakeUpper()

void ON_wString::MakeUpper ( )

◆ MakeUpperOrdinal()

void ON_wString::MakeUpperOrdinal ( )

◆ MapCharacterOrdinal()

static wchar_t ON_wString::MapCharacterOrdinal ( ON_StringMapOrdinalType  map_type,
wchar_t  c 
)
static

Map a single wchar_t element to upper or lower case.

Parameters
c[in] If sizeof(wchar_t) >= 2 and c is not a value used int surrogate pairs, the map specified by map_type is applied. If c is a value used in surrogate pairs, the value is not changed.

1) MapCharacterOrdinal is not appropriate for general string mapping because it does not correctly handle surrogate pairs. 2) If sizeof(wchar_t) == sizeof(char), ON_String::MapCharacterOrdinal() and ON_wString::MapCharacterOrdinal() are identical.

◆ MapString() [1/3]

ON_wString ON_wString::MapString ( const class ON_Locale locale,
ON_StringMapType  map_type 
) const

◆ MapString() [2/3]

static ON_wString ON_wString::MapString ( const class ON_Locale locale,
ON_StringMapType  map_type,
const wchar_t *  string,
int  element_count 
)
static

◆ MapString() [3/3]

static int ON_wString::MapString ( const class ON_Locale locale,
ON_StringMapType  map_type,
const wchar_t *  string,
int  element_count,
wchar_t *  mapped_string,
int  mapped_string_capacity 
)
static

Maps element_count elements of string[] to mapped_string[].

Parameters
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 wchar_t 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.

Parameters
mapped_string[out] The result of the mapping is returned in mapped_string[].
mapped_string_capacity[in] Number of wchar_t elements available in mapped_string[] or 0 to calculate the minimum number of elements needed for the mapping.
Returns

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.

◆ MapStringOrdinal() [1/2]

ON_wString ON_wString::MapStringOrdinal ( ON_StringMapOrdinalType  map_type) const

◆ MapStringOrdinal() [2/2]

static int ON_wString::MapStringOrdinal ( ON_StringMapOrdinalType  map_type,
const wchar_t *  string,
int  element_count,
wchar_t *  mapped_string,
int  mapped_string_capacity 
)
static

Map a wchar_t string.

Parameters
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[]. mapped_string_capacity must be >= mapped_element_count where mapped_element_count = (element_count >= 0) element_count ? ON_wString::Length(string).
map_type[in]
Returns

Number of mapped_string[] elements that were mapped from string[].

When the return value is < mapped_string_capacity, a null terminator is appended after the last mapped element.

◆ Mid() [1/2]

ON_wString ON_wString::Mid ( int  ,
int   
) const

simple sub-string extraction

◆ Mid() [2/2]

ON_wString ON_wString::Mid ( int  ) const

◆ operator const wchar_t *()

ON_wString::operator const wchar_t * ( ) const

◆ operator+() [1/8]

ON_wString ON_wString::operator+ ( const ON_wString ) const

◆ operator+() [2/8]

ON_wString ON_wString::operator+ ( const ON_String sUTF8) const

◆ operator+() [3/8]

ON_wString ON_wString::operator+ ( char  ) const

◆ operator+() [4/8]

ON_wString ON_wString::operator+ ( unsigned  char) const

◆ operator+() [5/8]

ON_wString ON_wString::operator+ ( wchar_t  ) const

◆ operator+() [6/8]

ON_wString ON_wString::operator+ ( const char *  sUTF8) const

◆ operator+() [7/8]

ON_wString ON_wString::operator+ ( const unsigned char *  sUTF8) const

◆ operator+() [8/8]

ON_wString ON_wString::operator+ ( const wchar_t *  ) const

◆ operator+=() [1/8]

const ON_wString& ON_wString::operator+= ( const ON_wString )

◆ operator+=() [2/8]

const ON_wString& ON_wString::operator+= ( const ON_String sUTF8)

◆ operator+=() [3/8]

const ON_wString& ON_wString::operator+= ( char  )

◆ operator+=() [4/8]

const ON_wString& ON_wString::operator+= ( unsigned  char)

◆ operator+=() [5/8]

const ON_wString& ON_wString::operator+= ( wchar_t  )

◆ operator+=() [6/8]

const ON_wString& ON_wString::operator+= ( const char *  sUTF8)

◆ operator+=() [7/8]

const ON_wString& ON_wString::operator+= ( const unsigned char *  sUTF8)

◆ operator+=() [8/8]

const ON_wString& ON_wString::operator+= ( const wchar_t *  )

◆ operator=() [1/8]

const ON_wString& ON_wString::operator= ( const ON_wString )

overloaded assignment

◆ operator=() [2/8]

const ON_wString& ON_wString::operator= ( const ON_String src)

◆ operator=() [3/8]

const ON_wString& ON_wString::operator= ( char  )

◆ operator=() [4/8]

const ON_wString& ON_wString::operator= ( const char *  src)

◆ operator=() [5/8]

const ON_wString& ON_wString::operator= ( unsigned  char)

◆ operator=() [6/8]

const ON_wString& ON_wString::operator= ( const unsigned char *  src)

◆ operator=() [7/8]

const ON_wString& ON_wString::operator= ( wchar_t  )

◆ operator=() [8/8]

const ON_wString& ON_wString::operator= ( const wchar_t *  )

◆ operator[]() [1/2]

wchar_t& ON_wString::operator[] ( int  )

◆ operator[]() [2/2]

wchar_t ON_wString::operator[] ( int  ) const

◆ PreciseFromNumber()

static const ON_wString ON_wString::PreciseFromNumber ( double  d)
static

◆ Remove() [1/3]

int ON_wString::Remove ( char  utf8_single_byte_c)

Remove all occurrences of the input character.

Parameters
c[in] utf8_single_byte_ct must have a value between 0 and 0x7F. When w is a 2 byte UTF-16 wchar_t value (like Microsoft's wchar_t), it must be in the range 0 to 0xD7FF or 0xE000 to 0xFFFF. When w is a 4 byte UTF-32 wchar_t value (like Apple's wchar_t), it must be in the range 0 to 0xD7FF or 0xE000 to 0x10FFFF.
Returns
Number of characters removed.

◆ Remove() [2/3]

int ON_wString::Remove ( unsigned char  utf8_single_byte_c)

◆ Remove() [3/3]

int ON_wString::Remove ( wchar_t  w)

◆ RemovePrefix()

const ON_wString ON_wString::RemovePrefix ( const wchar_t *  prefix,
const class ON_Locale locale,
bool  bIgnoreCase 
) const
Parameters
prefix[in]
locale[in] When no local is available, pass ON_Locale::Ordinal.
bIgnoreCase[in] true to ignore case.
Returns
If the string begins with prefix, the returned string has prefix removed. Otherwise the returned string is identical to the string.

◆ RemoveSuffix()

const ON_wString ON_wString::RemoveSuffix ( const wchar_t *  suffix,
const class ON_Locale locale,
bool  bIgnoreCase 
) const
Parameters
suffix[in]
locale[in] When no local is available, pass ON_Locale::Ordinal.
bIgnoreCase[in] true to ignore case.
Returns
If the string ends with suffix, the returned string has suffix removed. Otherwise the returned string is identical to the string.

◆ RemoveWhiteSpace()

int ON_wString::RemoveWhiteSpace ( const wchar_t *  whitespace = 0)

Removes all white-space characters with the token.

Parameters
whitespace[in] if not null, this is a 0 terminated string that lists the characters considered to be white space. If null, then (1,2,...,32,127) is used.
Returns
Number of whitespace characters removed.
See also
ON_wString::ReplaceWhiteSpace

◆ Replace() [1/2]

int ON_wString::Replace ( const wchar_t *  token1,
const wchar_t *  token2 
)

Replace all substrings that match token1 with token2

Parameters
token1[in]
token2[in]
Returns
Number of times toke1 was replaced with token2

◆ Replace() [2/2]

int ON_wString::Replace ( wchar_t  token1,
wchar_t  token2 
)

◆ ReplaceWhiteSpace()

int ON_wString::ReplaceWhiteSpace ( wchar_t  token,
const wchar_t *  whitespace = 0 
)

Replace all white-space characters with the token. If token is zero, the string will end up with internal 0's

Parameters
token[in]
whitespace[in] if not null, this is a 0 terminated string that lists the characters considered to be white space. If null, then (1,2,...,32,127) is used.
Returns
Number of whitespace characters replaced.
See also
ON_wString::RemoveWhiteSpace

◆ ReserveArray()

wchar_t* ON_wString::ReserveArray ( size_t  )

Low level access to string contents as character array.

◆ Reverse() [1/2]

ON_wString ON_wString::Reverse ( ) const

upper/lower/reverse conversion

◆ Reverse() [2/2]

static wchar_t* ON_wString::Reverse ( wchar_t *  string,
int  element_count 
)
static

◆ ReverseFind() [1/5]

int ON_wString::ReverseFind ( char  utf8_single_byte_c) const

Find the last occurrence of a character or substring.

Parameters
utf8_single_byte_c[in] utf8_single_byte_c must have a value between 0 and 0x7F.
w[in] When w is a 2 byte UTF-16 wchar_t value (like Microsoft's wchar_t), it must be in the range 0 to 0xD7FF or 0xE000 to 0xFFFF. When w is a 4 byte UTF-32 wchar_t value (like Apple's wchar_t), it must be in the range 0 to 0xD7FF or 0xE000 to 0x10FFFF.
sUTF8[in]
wideString[in]
Returns
-1: Invalid input or character or substring was not found. >=0: Index of the final occurrence of the character or substring.

◆ ReverseFind() [2/5]

int ON_wString::ReverseFind ( unsigned char  utf8_single_byte_c) const

◆ ReverseFind() [3/5]

int ON_wString::ReverseFind ( wchar_t  w) const

◆ ReverseFind() [4/5]

int ON_wString::ReverseFind ( const char *  sUTF8) const

◆ ReverseFind() [5/5]

int ON_wString::ReverseFind ( const wchar_t *  wideString) const

◆ Right()

ON_wString ON_wString::Right ( int  ) const

◆ Scan()

int ON_VARGS_FUNC_CDECL ON_wString::Scan ( const wchar_t *  format,
  ... 
) const
Parameters
format[in] null terminated string to scan ... - [out] pointers to elements to assign.
Returns
>= 0: number of fields successfully converted and assigned. <0: failure

◆ ScanBuffer()

static int ON_VARGS_FUNC_CDECL ON_wString::ScanBuffer ( const wchar_t *  buffer,
const wchar_t *  format,
  ... 
)
static

◆ ScanBufferVargs()

static int ON_wString::ScanBufferVargs ( const wchar_t *  buffer,
const wchar_t *  format,
va_list  args 
)
static

◆ SetAt() [1/3]

void ON_wString::SetAt ( int  ,
char   
)

◆ SetAt() [2/3]

void ON_wString::SetAt ( int  ,
unsigned  char 
)

◆ SetAt() [3/3]

void ON_wString::SetAt ( int  ,
wchar_t   
)

◆ SetLength()

wchar_t* ON_wString::SetLength ( size_t  )

◆ ShrinkArray()

void ON_wString::ShrinkArray ( )

◆ SizeOf()

unsigned int ON_wString::SizeOf ( ) const
Returns
Total number of bytes of memory used by this class. (For use in ON_Object::SizeOf() overrides.

◆ SplitPath() [1/2]

static void ON_wString::SplitPath ( const char *  path,
ON_wString drive,
ON_wString dir,
ON_wString fname,
ON_wString ext 
)
static

◆ SplitPath() [2/2]

static void ON_wString::SplitPath ( const wchar_t *  path,
ON_wString drive,
ON_wString dir,
ON_wString fname,
ON_wString ext 
)
static

◆ SubString() [1/2]

const ON_wString ON_wString::SubString ( int  start_index) const

◆ SubString() [2/2]

const ON_wString ON_wString::SubString ( int  start_index,
int  count 
) const

◆ ToNumber() [1/9]

static const wchar_t* ON_wString::ToNumber ( const wchar_t *  buffer,
char  value_on_failure,
char *  value 
)
static
Returns
not zero: pointer to the first character that was not scanned nullptr: failure

◆ ToNumber() [2/9]

static const wchar_t* ON_wString::ToNumber ( const wchar_t *  buffer,
unsigned char  value_on_failure,
unsigned char *  value 
)
static

◆ ToNumber() [3/9]

static const wchar_t* ON_wString::ToNumber ( const wchar_t *  buffer,
short  value_on_failure,
short *  value 
)
static

◆ ToNumber() [4/9]

static const wchar_t* ON_wString::ToNumber ( const wchar_t *  buffer,
unsigned short  value_on_failure,
unsigned short *  value 
)
static

◆ ToNumber() [5/9]

static const wchar_t* ON_wString::ToNumber ( const wchar_t *  buffer,
int  value_on_failure,
int *  value 
)
static

◆ ToNumber() [6/9]

static const wchar_t* ON_wString::ToNumber ( const wchar_t *  buffer,
unsigned int  value_on_failure,
unsigned int *  value 
)
static

◆ ToNumber() [7/9]

static const wchar_t* ON_wString::ToNumber ( const wchar_t *  buffer,
ON__INT64  value_on_failure,
ON__INT64 *  value 
)
static

◆ ToNumber() [8/9]

static const wchar_t* ON_wString::ToNumber ( const wchar_t *  buffer,
ON__UINT64  value_on_failure,
ON__UINT64 *  value 
)
static

◆ ToNumber() [9/9]

static const wchar_t* ON_wString::ToNumber ( const wchar_t *  buffer,
double  value_on_failure,
double *  value 
)
static

◆ TrimLeft()

void ON_wString::TrimLeft ( const wchar_t *  s = nullptr)

Removes leading elements from the string.

Parameters
s[in] All leading wchar_t elements with a value that it found in s[] are removed. If s is nullptr, All leading wchar_t element with a value between 1 and space are removed.

◆ TrimLeftAndRight()

void ON_wString::TrimLeftAndRight ( const wchar_t *  s = nullptr)

◆ TrimRight()

void ON_wString::TrimRight ( const wchar_t *  s = nullptr)

Removes trailing elements from the string.

Parameters
s[in] All trailing wchar_t elements with a value that it found in s[] are removed. If s is nullptr, All trailing wchar_t elements with a value between 1 and space are removed.

◆ UnsignedLength() [1/2]

unsigned int ON_wString::UnsignedLength ( ) const
Returns
number of nonzero elements in the string.

◆ UnsignedLength() [2/2]

static unsigned int ON_wString::UnsignedLength ( const wchar_t *  string)
static
Returns
number of nonzero elements in string before the first null terminator. If string is nullptr, 0 is returned.

◆ UrlDecode()

bool ON_wString::UrlDecode ( )

Replaces all xx where xx a two digit hexadecimal number, with a single character. Returns false if the orginal string contained

◆ UrlEncode()

void ON_wString::UrlEncode ( )

Replaces all characters in the string whose values are not '0-9', 'A-Z', or 'a-z' with a percent sign followed by a 2 digit hex value.

◆ WildCardMatch()

bool ON_wString::WildCardMatch ( const wchar_t *  ) 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.

Parameters
pattern[in] pattern string where ? and * are wild cards.
Returns
true if the string mathes the wild card pattern.

◆ WildCardMatchNoCase()

bool ON_wString::WildCardMatchNoCase ( const wchar_t *  ) 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.

Parameters
pattern[in] pattern string where ? and * are wild cards.
Returns
true if the string mathes the wild card pattern.

Member Data Documentation

◆ Backslash

const wchar_t ON_wString::Backslash
static

◆ Backspace

const wchar_t ON_wString::Backspace
static

◆ CarriageReturn

const wchar_t ON_wString::CarriageReturn
static

◆ EmptyString

const ON_wString ON_wString::EmptyString
static

◆ Escape

const wchar_t ON_wString::Escape
static

◆ FormFeed

const wchar_t ON_wString::FormFeed
static

◆ LineFeed

const wchar_t ON_wString::LineFeed
static

◆ m_s

wchar_t* ON_wString::m_s
protected

Implementation.

◆ Pipe

const wchar_t ON_wString::Pipe
static

◆ Slash

const wchar_t ON_wString::Slash
static

◆ Space

const wchar_t ON_wString::Space
static

◆ Tab

const wchar_t ON_wString::Tab
static

◆ VerticalTab

const wchar_t ON_wString::VerticalTab
static