RLib  5.7
RLib - an opensource, lightweight and multi-platform framework for cpp programming
System::String Class Reference

Represents text as a sequence of GBK/UTF-16 code units More...

Public Types

typedef String(* __match_callback) (_In_ LPCTSTR lpbegin, _In_ LPCTSTR lpend)
 
typedef __match_callback MatchCallback
 

Public Member Functions

 String ()
 Initializes a new instance of the String class to Null state More...
 
 String (STRNull)
 Initializes a new instance of the String class to Null state More...
 
 String (intptr_t length)
 Initializes a new instance of the String class with the capacity to hold the specified length of characters More...
 
 String (TCHAR *lptstr, intptr_t length=-1)
 Initializes a new instance of the String, and copys the specified length of characters More...
 
 String (const STRInfoA &si)
 Initializes a new instance of the String, and makes a reference to the specified const string More...
 
 String (const char *lpstr)
 Initializes a new instance of the String, and makes a reference to the specified const string More...
 
 String (const char *lpstr, intptr_t length)
 Initializes a new instance of the String, and copys the specified length of characters More...
 
 String (const STRInfoW &si)
 Initializes a new instance of the String, and makes a reference to the specified const string More...
 
 String (const wchar_t *lpwstr)
 Initializes a new instance of the String, and makes a reference to the specified const string More...
 
 String (const wchar_t *lpwstr, intptr_t length)
 Initializes a new instance of the String, and copys the specified length of characters More...
 
 String (const String &str)
 Initializes a new instance of the String from a existing String More...
 
 String (String &&tmpstr)
 Initializes a new instance of the String from a existing rvalue String More...
 
 ~String ()
 Releases string resources More...
 
String Reserve (intptr_t length)
 Preallocates storage space for holding the specified length of characters, copies the original string and returns new instance of result string More...
 
Stringreserve (intptr_t length, bool keep=true)
 Preallocates storage space for holding the specified length of characters, and determines whether to keep the original string or not More...
 
 operator TCHAR * ()
 
RLIB_INLINE operator const TCHAR * ()
 
RLIB_INLINE operator const TCHAR * () const
 
Stringoperator= (STRNull)
 实现拓展语法( String = Nothing ), 调用析构函数释放内存 此时 IsNull() 返回 true More...
 
Stringoperator= (TCHAR *lptstr)
 将字符串赋给当前 String 实例, 该方法将立即进行拷贝操作 More...
 
Stringoperator= (const STRInfoA &)
 以指定的字符串结构对当前 String 实例进行赋值 方法行为取决于具体编译环境, 实例生命期内必须确保对应字符串不会被修改 More...
 
Stringoperator= (const STRInfoW &)
 以指定的字符串结构对当前 String 实例进行赋值 方法行为取决于具体编译环境, 实例生命期内必须确保对应字符串不会被修改 More...
 
Stringoperator= (const char *lpstr)
 以指定的字符串对当前 String 实例进行赋值 方法行为取决于具体编译环境, 实例生命期内必须确保对应字符串不会被修改 More...
 
Stringoperator= (const wchar_t *lpwstr)
 以指定的字符串对当前 String 实例进行赋值 方法行为取决于具体编译环境, 实例生命期内必须确保对应字符串不会被修改 More...
 
Stringoperator= (const String &str)
 以指定的 String 实例 对当前 String 实例进行赋值 More...
 
Stringoperator= (String &&tmpstr)
 以指定的 String 实例 对当前 String 实例进行赋值 More...
 
 RLIB_PROPERTY_GET (const intptr_t Size, GetSize)
 获取字符串缓冲区大小(包括 \0 结尾符大小, in bytes) More...
 
 RLIB_PROPERTY_GET (const intptr_t Length, GetLength)
 获取字符串长度(in TCHARs, 不包括结尾'\0') More...
 
 RLIB_PROPERTY_GET (const intptr_t CanReadSize, GetCanReadSize)
 获取字符串可读取大小(不包含结尾'\0'的大小, in bytes) More...
 
intptr_t GetSize () const
 返回字符串缓冲区大小(包括 \0 结尾符大小, in bytes) More...
 
intptr_t GetLength () const
 返回字符串长度(in TCHARs, 不包括结尾'\0') More...
 
intptr_t GetCanReadSize () const
 返回字符串可读取大小, in bytes More...
 
LPTSTR GetData ()
 方法返回内部字符串指针并保证可读写, 对其修改将影响到 String 实例 More...
 
LPCTSTR GetConstData () const
 返回只读字符串指针, 不应该修改该方法返回的字符串内容 返回值为可安全用于显示(如MsgBox)的只读字符串指针 More...
 
TCHAR * GetType () const
 获取对象类型 More...
 
TCHAR * c_str () const
 创建一个与指定的 String 具有相同值的可读 TCHAR * 副本, 该副本必须手动调用 Collect() 方法才能正确释放 More...
 
TCHAR GetAt (intptr_t) const
 获取当前 String 对象中位于指定字符位置(从0开始)的字符 方法不进行参数检查, 请保证不会溢出 More...
 
void SetAt (intptr_t, TCHAR)
 设置当前 string 对象中位于指定字符位置(从0开始)的字符 More...
 
bool tryCopy (LPCTSTR pstr, intptr_t len)
 尝试将指定数目的字符复制到当前 String 实例, 该方法不会分配新的内存, 空间不足返回false More...
 
Stringcopy (const char *pstr, intptr_t len=-1)
 将指定数目的字符复制到当前 String 实例 More...
 
Stringcopy (const wchar_t *pstr, intptr_t len=-1)
 将指定数目的字符复制到当前 String 实例 More...
 
Stringcopy (const String &str, intptr_t len=-1)
 将指定 String 复制到当前 String 实例 More...
 
String &__cdecl copyf (_In_ _Printf_format_string_ LPCTSTR pstrFormat,...)
 将指定的 String 中的每个格式项替换为相应对象的值的文本等效项 More...
 
Stringappend (const TCHAR c)
 追加指定字符到当前 String 实例 More...
 
Stringappend (const TCHAR *pstr, intptr_t len=-1)
 追加指定长度字符串到当前 String 实例 More...
 
Stringappend (const String &str, intptr_t len=-1)
 追加指定长度 String 到当前实例 More...
 
String &__cdecl appendf (_In_ _Printf_format_string_ LPCTSTR pstrFormat,...)
 将文本以指定格式追加到当前实例 More...
 
void CopyTo (TCHAR *pstr, intptr_t max_length_with_null)
 将当期实例表示的字符串复制到指定的缓冲区 More...
 
TCHAR front () const
 Access first character, or _T('\0') More...
 
TCHAR back () const
 Access last character, or _T('\0') More...
 
bool StartsWith (TCHAR) const
 确定 String 实例的开头是否与指定的字符匹配 More...
 
bool EndsWith (TCHAR) const
 确定 String 的实例的末尾是否与指定的字符匹配 More...
 
bool StartsWith (LPCTSTR pstr, intptr_t length=-1) const
 确定 String 实例的开头是否与指定的字符串匹配 More...
 
bool EndsWith (LPCTSTR pstr, intptr_t length=-1) const
 确定 String 的实例的末尾是否与指定的字符串匹配 More...
 
bool Contains (LPCTSTR value) const
 
bool Contains (TCHAR c) const
 返回一个值,该值指示指定的字符是否出现在此字符串中。 More...
 
bool ContainsNoCase (LPCTSTR value) const
 This method performs an special (case-insensitive and culture-insensitive) comparison. The search begins at the first character position of this string and continues through the last character position More...
 
intptr_t Compare (const TCHAR *) const
 与指定的字符串进行比较(考虑其大小写), 并返回一个整数, 指示二者在排序顺序中的相对位置 More...
 
intptr_t CompareNoCase (const TCHAR *) const
 Compare strings ignoring the case of the strings being compared More...
 
StringEmpty ()
 使 String 成为空字符串 More...
 
bool IsConst () const
 判断字符串是否为引用类型(不能直接修改字符串) More...
 
bool IsEmpty () const
 判断是否为空字符串 More...
 
bool IsNull () const
 判断是否为空字符串指针(nullptr) More...
 
bool IsNullOrEmpty () const
 判断是否为空字符串或空字符串指针(nullptr) More...
 
intptr_t IndexOf (TCHAR, intptr_t begin=0) const
 报告指定字符在此字符串中的第一个匹配项的索引,如果未找到该字符串,则返回 -1 More...
 
intptr_t LastIndexOf (TCHAR) const
 报告指定字符在在此实例中的最后一个匹配项的索引位置,如果未找到该字符串,则返回 -1 More...
 
intptr_t IndexOf (const TCHAR *, intptr_t begin=0) const
 报告 string 或一个或多个字符在此字符串中的第一个匹配项的索引,如果未找到该字符串,则返回 -1 More...
 
intptr_t LastIndexOf (const TCHAR *) const
 报告 string 或一个或多个字符在在此实例中的最后一个匹配项的索引位置,如果未找到该字符串,则返回 -1 More...
 
intptr_t LastIndexOfL (const TCHAR *, intptr_t len) const
 报告 string 或一个或多个字符在在此实例中的最后一个匹配项的索引位置,如果未找到该字符串,则返回 -1 More...
 
intptr_t IndexOfNoCase (const TCHAR *, intptr_t begin=0) const
 报告 string 或一个或多个字符在此字符串中的第一个匹配项的索引,如果未找到该字符串,则返回 -1 Compare strings ignoring the case of the strings being compared More...
 
intptr_t LastIndexOfNoCase (const TCHAR *) const
 报告 string 或一个或多个字符在在此实例中的最后一个匹配项的索引位置,如果未找到该字符串,则返回 -1 Compare strings ignoring the case of the strings being compared More...
 
intptr_t LastIndexOfLNoCase (const TCHAR *, intptr_t len) const
 报告 string 或一个或多个字符在在此实例中的最后一个匹配项的索引位置,如果未找到该字符串,则返回 -1 Compare strings ignoring the case of the strings being compared More...
 
intptr_t IndexOfR (const TCHAR *, intptr_t begin=0) const
 报告 string 或一个或多个字符在此字符串中的第一个匹配项的索引, 并返回末位索引(加上指定字符串长度),如果未找到该字符串,则返回 -1 More...
 
intptr_t IndexOfRL (const TCHAR *, intptr_t len, intptr_t begin=0) const
 报告 string 或一个或多个字符在此字符串中的第一个匹配项的索引, 并返回末位索引(加上指定字符串长度),如果未找到该字符串,则返回 -1 More...
 
intptr_t LastIndexOfR (const TCHAR *) const
 报告 string 或一个或多个字符在在此实例中的最后一个匹配项的索引位置, 并返回末位索引,如果未找到该字符串,则返回 -1 More...
 
intptr_t LastIndexOfRL (const TCHAR *, intptr_t len) const
 报告 string 或一个或多个字符在在此实例中的最后一个匹配项的索引位置, 并返回末位索引,如果未找到该字符串,则返回 -1 More...
 
intptr_t IndexOfRNoCase (const TCHAR *, intptr_t begin=0) const
 报告 string 或一个或多个字符在此字符串中的第一个匹配项的索引, 并返回末位索引(加上指定字符串长度),如果未找到该字符串,则返回 -1 Compare strings ignoring the case of the strings being compared More...
 
intptr_t IndexOfRLNoCase (const TCHAR *, intptr_t len, intptr_t begin=0) const
 报告 string 或一个或多个字符在此字符串中的第一个匹配项的索引, 并返回末位索引(加上指定字符串长度),如果未找到该字符串,则返回 -1 Compare strings ignoring the case of the strings being compared More...
 
intptr_t LastIndexOfRNoCase (const TCHAR *) const
 报告 string 或一个或多个字符在在此实例中的最后一个匹配项的索引位置, 并返回末位索引,如果未找到该字符串,则返回 -1 Compare strings ignoring the case of the strings being compared More...
 
intptr_t LastIndexOfRLNoCase (const TCHAR *, intptr_t len) const
 报告 string 或一个或多个字符在在此实例中的最后一个匹配项的索引位置, 并返回末位索引,如果未找到该字符串,则返回 -1 Compare strings ignoring the case of the strings being compared More...
 
intptr_t CountOf (const TCHAR *, intptr_t begin=0) const
 计算指定文本出现的次数 More...
 
String Concat (const TCHAR *, intptr_t len=-1) const
 将指定长度 字符串 拼到当前 String 末尾并返回新实例 方法不会影响当前实例 More...
 
String Concat (const String &, intptr_t len=-1) const
 将指定长度 String 拼到当前 String 末尾并返回新实例 方法不会影响当前实例 More...
 
String Reverse () const
 返回此 String 颠倒字符次序后的副本 More...
 
Stringreverse ()
 将当前 String 颠倒字符次序 More...
 
String ToLower () const
 返回此 String 转换为小写形式的副本 More...
 
StringtoLower ()
 将当前 String 转换为小写形式 More...
 
String ToUpper () const
 返回此 String 转换为大写形式的副本 More...
 
StringtoUpper ()
 将当前 String 转换为大写形式 More...
 
String Trim (TCHAR c=0) const
 返回当前 String 对象移除所有前导指定字符和尾部指定字符后的副本 More...
 
Stringtrim (TCHAR c=0)
 从当前 String 对象移除所有前导指定字符和尾部指定字符 More...
 
String TrimStart (TCHAR c=0) const
 从当前 String 对象移除数组中指定的一组字符的所有前导指定字符后的副本 More...
 
StringtrimStart (TCHAR c=0)
 从当前 String 对象移除数组中指定的一组字符的所有前导指定字符 More...
 
String TrimEnd (TCHAR c=0) const
 从当前 String 对象移除数组中指定的一组字符的所有尾部指定字符后的副本 More...
 
StringtrimEnd (TCHAR c=0)
 从当前 String 对象移除数组中指定的一组字符的所有尾部指定字符 More...
 
String PadRight (intptr_t totalWidth, TCHAR paddingChar=_T(' ')) const
 Returns a new string that left-aligns the characters in this string by padding them on the right with a specified character, for a specified total length More...
 
StringpadRight (intptr_t totalWidth, TCHAR paddingChar=_T(' '))
 Left-aligns the characters in this string by padding them on the right with a specified character, for a specified total length More...
 
String PadLeft (intptr_t totalWidth, TCHAR paddingChar=_T(' ')) const
 Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified character, for a specified total length More...
 
StringpadLeft (intptr_t totalWidth, TCHAR paddingChar=_T(' '))
 Right-aligns the characters in this instance by padding them on the left with a specified character, for a specified total length More...
 
String Replace (const TCHAR *pstrFrom, const TCHAR *pstrTo, intptr_t begin=0, intptr_t n=0, intptr_t *replace_count=nullptr) const
 返回一个新字符串, 其中当前实例中出现的 n 个指定字符串都替换为另一个指定的字符串, 若 n 为 0 则替换全部项 More...
 
String ReplaceNoCase (const TCHAR *pstrFrom, const TCHAR *pstrTo, intptr_t begin=0, intptr_t n=0, intptr_t *replace_count=nullptr) const
 返回一个新字符串, 其中当前实例中出现的 n 个指定字符串都替换为另一个指定的字符串并忽略大小写, 若 n 为 0 则替换全部项 More...
 
Stringreplace (const TCHAR *pstrFrom, const TCHAR *pstrTo, intptr_t begin=0, intptr_t n=0, intptr_t *replace_count=nullptr)
 将当前实例中出现的 n 个指定字符串都替换为另一个指定的字符串, 若 n 为 0 则替换全部项 More...
 
StringreplaceNoCase (const TCHAR *pstrFrom, const TCHAR *pstrTo, intptr_t begin=0, intptr_t n=0, intptr_t *replace_count=nullptr)
 将当前实例中出现的 n 个指定字符串都替换为另一个指定的字符串并忽略大小写, 若 n 为 0 则替换全部项 More...
 
String Substring (intptr_t index, intptr_t length=-1) const
 从此实例检索并返回新的子字符串, 子字符串从指定的字符位置(从0开始)开始且具有指定的长度 More...
 
Stringsubstring (intptr_t index, intptr_t length=-1)
 从此实例检索子字符串, 子字符串从指定的字符位置(从0开始)开始且具有指定的长度 More...
 
class StringArraySplit (const String &strSeparator, bool removeEmptyEntries=false) const
 返回的字符串数组包含此实例中的子字符串(由指定字符串的元素分隔) More...
 
class StringArraySplit (const TCHAR *strSeparator, intptr_t lengthOfSeparator, intptr_t averageItemLength, bool removeEmptyEntries=false) const
 返回的字符串数组包含此实例中的子字符串(由指定字符串的元素分隔) More...
 
Collections::Generic::Array< LPTSTR > * FastSplit (const TCHAR *strSeparator, intptr_t lengthOfSeparator, intptr_t averageItemLength)
 快速拆分此实例中的子字符串(由指定字符串的元素分隔), 并返回字符串引用数组(不进行任何拷贝) More...
 
String Match (const TCHAR *, const TCHAR *, intptr_t begin=0) const
 Performs a lazy/non-greedy text match and returns the first matched More...
 
String MatchReplace (const TCHAR *, const TCHAR *, const TCHAR *replaceTo, intptr_t begin=0) const
 Performs a lazy/non-greedy text match and replaces the first matched More...
 
String MatchReplace (const TCHAR *, const TCHAR *, MatchCallback callback, intptr_t begin=0) const
 Performs a lazy/non-greedy text match and replaces all matched using a callback More...
 
class StringArrayMatchAll (const TCHAR *, const TCHAR *, intptr_t begin=0) const
 Performs a lazy/non-greedy text match and returns all matched as StringArray More...
 
String MatchNoCase (const TCHAR *, const TCHAR *, intptr_t begin=0) const
 Performs a lazy/non-greedy text match(case insensitive) and returns the first matched More...
 
String MatchReplaceNoCase (const TCHAR *, const TCHAR *, const TCHAR *replaceTo, intptr_t begin=0) const
 Performs a lazy/non-greedy text match(case insensitive) and replaces the first matched More...
 
String MatchReplaceNoCase (const TCHAR *, const TCHAR *, MatchCallback callback, intptr_t begin=0) const
 Performs a lazy/non-greedy text match(case insensitive) and replaces using a callback More...
 
StringArrayMatchAllNoCase (const TCHAR *, const TCHAR *, intptr_t begin=0) const
 Performs a lazy/non-greedy text match(case insensitive) and returns all matched as StringArray More...
 
TCHAR & operator[] (intptr_t)
 
const TCHAR & operator[] (intptr_t) const
 
Stringoperator+= (const TCHAR c)
 
Stringoperator+= (const TCHAR *)
 
Stringoperator+= (const String &)
 
RLIB_INLINE Stringoperator+= (const STRInfo &si)
 
bool operator== (LPCTSTR) const
 
bool operator== (const String &) const
 
bool operator!= (LPCTSTR) const
 
bool operator!= (const String &) const
 
bool operator<= (LPCTSTR) const
 
bool operator<= (const String &) const
 
bool operator< (LPCTSTR) const
 
bool operator< (const String &) const
 
bool operator>= (LPCTSTR) const
 
bool operator>= (const String &) const
 
bool operator> (LPCTSTR) const
 
bool operator> (const String &) const
 
template<typename T >
StringappendCompose (const T &t)
 
template<typename T , typename... Args>
StringappendCompose (const T &t, const Args &...args)
 
TCHAR * begin ()
 
const TCHAR * begin () const
 
TCHAR * end ()
 
const TCHAR * end () const
 

Static Public Member Functions

static void FastStringCopy (TCHAR *__restrict destmem, const TCHAR *__restrict srcmem, intptr_t Count)
 Performs optimized string copy More...
 
static void Collect (LPVOID)
 Releases string with reference count More...
 

Public Attributes

 RLIB_DECLARE_DYNCREATE
 

Static Public Attributes

static TCHAR nullpstr [1] = { _T('\0') }
 
static const TCHAR * nullpcstr = String::nullpstr
 

Protected Attributes

TCHAR * m_pstr
 
intptr_t m_len
 
intptr_t m_size
 

Friends

class StringArray
 

Detailed Description

Represents text as a sequence of GBK/UTF-16 code units

Constructor & Destructor Documentation

String::String ( )

Initializes a new instance of the String class to Null state

System::String::String ( STRNull  )
inline

Initializes a new instance of the String class to Null state

String::String ( intptr_t  length)
explicit

Initializes a new instance of the String class with the capacity to hold the specified length of characters

System::String::String ( TCHAR *  lptstr,
intptr_t  length = -1 
)

Initializes a new instance of the String, and copys the specified length of characters

String::String ( const STRInfoA si)

Initializes a new instance of the String, and makes a reference to the specified const string

String::String ( const char *  lpstr)

Initializes a new instance of the String, and makes a reference to the specified const string

String::String ( const char *  lpstr,
intptr_t  length 
)

Initializes a new instance of the String, and copys the specified length of characters

String::String ( const STRInfoW si)

Initializes a new instance of the String, and makes a reference to the specified const string

String::String ( const wchar_t *  lpwstr)

Initializes a new instance of the String, and makes a reference to the specified const string

String::String ( const wchar_t *  lpwstr,
intptr_t  length 
)

Initializes a new instance of the String, and copys the specified length of characters

String::String ( const String str)

Initializes a new instance of the String from a existing String

String::String ( String &&  tmpstr)

Initializes a new instance of the String from a existing rvalue String

String::~String ( )

Releases string resources

Member Function Documentation

String & String::append ( const TCHAR  c)

追加指定字符到当前 String 实例

String& System::String::append ( const TCHAR *  pstr,
intptr_t  len = -1 
)

追加指定长度字符串到当前 String 实例

String& System::String::append ( const String str,
intptr_t  len = -1 
)

追加指定长度 String 到当前实例

String &__cdecl String::appendf ( _In_ _Printf_format_string_ LPCTSTR  pstrFormat,
  ... 
)

将文本以指定格式追加到当前实例

TCHAR String::back ( ) const

Access last character, or _T('\0')

TCHAR * String::c_str ( ) const

创建一个与指定的 String 具有相同值的可读 TCHAR * 副本, 该副本必须手动调用 Collect() 方法才能正确释放

void String::Collect ( LPVOID  ptr)
static

Releases string with reference count

intptr_t String::Compare ( const TCHAR *  ) const

与指定的字符串进行比较(考虑其大小写), 并返回一个整数, 指示二者在排序顺序中的相对位置

intptr_t String::CompareNoCase ( const TCHAR *  ) const

Compare strings ignoring the case of the strings being compared

String System::String::Concat ( const TCHAR *  ,
intptr_t  len = -1 
) const

将指定长度 字符串 拼到当前 String 末尾并返回新实例 方法不会影响当前实例

String System::String::Concat ( const String ,
intptr_t  len = -1 
) const

将指定长度 String 拼到当前 String 末尾并返回新实例 方法不会影响当前实例

bool System::String::Contains ( TCHAR  c) const

返回一个值,该值指示指定的字符是否出现在此字符串中。

bool String::ContainsNoCase ( LPCTSTR  value) const

This method performs an special (case-insensitive and culture-insensitive) comparison. The search begins at the first character position of this string and continues through the last character position

String& System::String::copy ( const char *  pstr,
intptr_t  len = -1 
)

将指定数目的字符复制到当前 String 实例

String& System::String::copy ( const wchar_t *  pstr,
intptr_t  len = -1 
)

将指定数目的字符复制到当前 String 实例

String& System::String::copy ( const String str,
intptr_t  len = -1 
)

将指定 String 复制到当前 String 实例

String &__cdecl String::copyf ( _In_ _Printf_format_string_ LPCTSTR  pstrFormat,
  ... 
)

将指定的 String 中的每个格式项替换为相应对象的值的文本等效项

void String::CopyTo ( TCHAR *  pstr,
intptr_t  max_length_with_null 
)

将当期实例表示的字符串复制到指定的缓冲区

Parameters
pstr字符串缓冲区
max_length最大可复制字符数, 包括中止符
intptr_t String::CountOf ( const TCHAR *  p1,
intptr_t  begin = 0 
) const

计算指定文本出现的次数

String & String::Empty ( )

使 String 成为空字符串

bool System::String::EndsWith ( TCHAR  ) const

确定 String 的实例的末尾是否与指定的字符匹配

bool System::String::EndsWith ( LPCTSTR  pstr,
intptr_t  length = -1 
) const

确定 String 的实例的末尾是否与指定的字符串匹配

Array< LPTSTR > * String::FastSplit ( const TCHAR *  strSeparator,
intptr_t  lengthOfSeparator,
intptr_t  averageItemLength 
)

快速拆分此实例中的子字符串(由指定字符串的元素分隔), 并返回字符串引用数组(不进行任何拷贝)

Warning
方法会影响当前实例字符串值
void String::FastStringCopy ( TCHAR *__restrict  destmem,
const TCHAR *__restrict  srcmem,
intptr_t  Count 
)
static

Performs optimized string copy

TCHAR String::front ( ) const

Access first character, or _T('\0')

TCHAR String::GetAt ( intptr_t  nIndex) const

获取当前 String 对象中位于指定字符位置(从0开始)的字符 方法不进行参数检查, 请保证不会溢出

intptr_t String::GetCanReadSize ( ) const

返回字符串可读取大小, in bytes

LPCTSTR String::GetConstData ( ) const

返回只读字符串指针, 不应该修改该方法返回的字符串内容 返回值为可安全用于显示(如MsgBox)的只读字符串指针

LPTSTR String::GetData ( )

方法返回内部字符串指针并保证可读写, 对其修改将影响到 String 实例

Warning
该缓冲区具有固定大小并可由 GetSize() 方法获得
intptr_t String::GetLength ( ) const

返回字符串长度(in TCHARs, 不包括结尾'\0')

intptr_t String::GetSize ( ) const

返回字符串缓冲区大小(包括 \0 结尾符大小, in bytes)

TCHAR* System::String::GetType ( ) const
inline

获取对象类型

intptr_t System::String::IndexOf ( TCHAR  ,
intptr_t  begin = 0 
) const

报告指定字符在此字符串中的第一个匹配项的索引,如果未找到该字符串,则返回 -1

intptr_t System::String::IndexOf ( const TCHAR *  ,
intptr_t  begin = 0 
) const

报告 string 或一个或多个字符在此字符串中的第一个匹配项的索引,如果未找到该字符串,则返回 -1

intptr_t String::IndexOfNoCase ( const TCHAR *  p,
intptr_t  begin = 0 
) const

报告 string 或一个或多个字符在此字符串中的第一个匹配项的索引,如果未找到该字符串,则返回 -1 Compare strings ignoring the case of the strings being compared

intptr_t String::IndexOfR ( const TCHAR *  p,
intptr_t  begin = 0 
) const

报告 string 或一个或多个字符在此字符串中的第一个匹配项的索引, 并返回末位索引(加上指定字符串长度),如果未找到该字符串,则返回 -1

intptr_t String::IndexOfRL ( const TCHAR *  p,
intptr_t  len,
intptr_t  begin = 0 
) const

报告 string 或一个或多个字符在此字符串中的第一个匹配项的索引, 并返回末位索引(加上指定字符串长度),如果未找到该字符串,则返回 -1

intptr_t String::IndexOfRLNoCase ( const TCHAR *  p,
intptr_t  len,
intptr_t  begin = 0 
) const

报告 string 或一个或多个字符在此字符串中的第一个匹配项的索引, 并返回末位索引(加上指定字符串长度),如果未找到该字符串,则返回 -1 Compare strings ignoring the case of the strings being compared

intptr_t String::IndexOfRNoCase ( const TCHAR *  p,
intptr_t  begin = 0 
) const

报告 string 或一个或多个字符在此字符串中的第一个匹配项的索引, 并返回末位索引(加上指定字符串长度),如果未找到该字符串,则返回 -1 Compare strings ignoring the case of the strings being compared

bool String::IsConst ( ) const

判断字符串是否为引用类型(不能直接修改字符串)

bool String::IsEmpty ( ) const

判断是否为空字符串

bool String::IsNull ( ) const

判断是否为空字符串指针(nullptr)

bool String::IsNullOrEmpty ( ) const

判断是否为空字符串或空字符串指针(nullptr)

intptr_t System::String::LastIndexOf ( TCHAR  ) const

报告指定字符在在此实例中的最后一个匹配项的索引位置,如果未找到该字符串,则返回 -1

intptr_t System::String::LastIndexOf ( const TCHAR *  ) const

报告 string 或一个或多个字符在在此实例中的最后一个匹配项的索引位置,如果未找到该字符串,则返回 -1

intptr_t String::LastIndexOfL ( const TCHAR *  p,
intptr_t  len 
) const

报告 string 或一个或多个字符在在此实例中的最后一个匹配项的索引位置,如果未找到该字符串,则返回 -1

intptr_t String::LastIndexOfLNoCase ( const TCHAR *  p,
intptr_t  len 
) const

报告 string 或一个或多个字符在在此实例中的最后一个匹配项的索引位置,如果未找到该字符串,则返回 -1 Compare strings ignoring the case of the strings being compared

intptr_t String::LastIndexOfNoCase ( const TCHAR *  p) const

报告 string 或一个或多个字符在在此实例中的最后一个匹配项的索引位置,如果未找到该字符串,则返回 -1 Compare strings ignoring the case of the strings being compared

intptr_t String::LastIndexOfR ( const TCHAR *  p) const

报告 string 或一个或多个字符在在此实例中的最后一个匹配项的索引位置, 并返回末位索引,如果未找到该字符串,则返回 -1

intptr_t String::LastIndexOfRL ( const TCHAR *  p,
intptr_t  len 
) const

报告 string 或一个或多个字符在在此实例中的最后一个匹配项的索引位置, 并返回末位索引,如果未找到该字符串,则返回 -1

intptr_t String::LastIndexOfRLNoCase ( const TCHAR *  p,
intptr_t  len 
) const

报告 string 或一个或多个字符在在此实例中的最后一个匹配项的索引位置, 并返回末位索引,如果未找到该字符串,则返回 -1 Compare strings ignoring the case of the strings being compared

intptr_t String::LastIndexOfRNoCase ( const TCHAR *  p) const

报告 string 或一个或多个字符在在此实例中的最后一个匹配项的索引位置, 并返回末位索引,如果未找到该字符串,则返回 -1 Compare strings ignoring the case of the strings being compared

String String::Match ( const TCHAR *  p1,
const TCHAR *  p2,
intptr_t  begin = 0 
) const

Performs a lazy/non-greedy text match and returns the first matched

StringArray * String::MatchAll ( const TCHAR *  p1,
const TCHAR *  p2,
intptr_t  begin = 0 
) const

Performs a lazy/non-greedy text match and returns all matched as StringArray

StringArray * String::MatchAllNoCase ( const TCHAR *  p1,
const TCHAR *  p2,
intptr_t  begin = 0 
) const

Performs a lazy/non-greedy text match(case insensitive) and returns all matched as StringArray

String String::MatchNoCase ( const TCHAR *  p1,
const TCHAR *  p2,
intptr_t  begin = 0 
) const

Performs a lazy/non-greedy text match(case insensitive) and returns the first matched

String System::String::MatchReplace ( const TCHAR *  ,
const TCHAR *  ,
const TCHAR *  replaceTo,
intptr_t  begin = 0 
) const

Performs a lazy/non-greedy text match and replaces the first matched

String System::String::MatchReplace ( const TCHAR *  ,
const TCHAR *  ,
MatchCallback  callback,
intptr_t  begin = 0 
) const

Performs a lazy/non-greedy text match and replaces all matched using a callback

String System::String::MatchReplaceNoCase ( const TCHAR *  ,
const TCHAR *  ,
const TCHAR *  replaceTo,
intptr_t  begin = 0 
) const

Performs a lazy/non-greedy text match(case insensitive) and replaces the first matched

String System::String::MatchReplaceNoCase ( const TCHAR *  ,
const TCHAR *  ,
MatchCallback  callback,
intptr_t  begin = 0 
) const

Performs a lazy/non-greedy text match(case insensitive) and replaces using a callback

RLIB_INLINE System::String::operator const TCHAR * ( )
inline

See also
GetConstData()
RLIB_INLINE System::String::operator const TCHAR * ( ) const
inline

See also
GetConstData()
String::operator TCHAR * ( )

See also
GetData()
String& System::String::operator= ( STRNull  )

实现拓展语法( String = Nothing ), 调用析构函数释放内存 此时 IsNull() 返回 true

String & String::operator= ( TCHAR *  lptstr)

将字符串赋给当前 String 实例, 该方法将立即进行拷贝操作

String& System::String::operator= ( const STRInfoA )

以指定的字符串结构对当前 String 实例进行赋值 方法行为取决于具体编译环境, 实例生命期内必须确保对应字符串不会被修改

String& System::String::operator= ( const STRInfoW )

以指定的字符串结构对当前 String 实例进行赋值 方法行为取决于具体编译环境, 实例生命期内必须确保对应字符串不会被修改

String & String::operator= ( const char *  lpstr)

以指定的字符串对当前 String 实例进行赋值 方法行为取决于具体编译环境, 实例生命期内必须确保对应字符串不会被修改

String & String::operator= ( const wchar_t *  lpwstr)

以指定的字符串对当前 String 实例进行赋值 方法行为取决于具体编译环境, 实例生命期内必须确保对应字符串不会被修改

String & String::operator= ( const String str)

以指定的 String 实例 对当前 String 实例进行赋值

String & String::operator= ( String &&  tmpstr)

以指定的 String 实例 对当前 String 实例进行赋值

String String::PadLeft ( intptr_t  totalWidth,
TCHAR  paddingChar = _T(' ') 
) const

Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified character, for a specified total length

String & String::padLeft ( intptr_t  totalWidth,
TCHAR  paddingChar = _T(' ') 
)

Right-aligns the characters in this instance by padding them on the left with a specified character, for a specified total length

String String::PadRight ( intptr_t  totalWidth,
TCHAR  paddingChar = _T(' ') 
) const

Returns a new string that left-aligns the characters in this string by padding them on the right with a specified character, for a specified total length

String & String::padRight ( intptr_t  totalWidth,
TCHAR  paddingChar = _T(' ') 
)

Left-aligns the characters in this string by padding them on the right with a specified character, for a specified total length

String String::Replace ( const TCHAR *  pstrFrom,
const TCHAR *  pstrTo,
intptr_t  begin = 0,
intptr_t  n = 0,
intptr_t *  replace_count = nullptr 
) const

返回一个新字符串, 其中当前实例中出现的 n 个指定字符串都替换为另一个指定的字符串, 若 n 为 0 则替换全部项

String & String::replace ( const TCHAR *  pstrFrom,
const TCHAR *  pstrTo,
intptr_t  begin = 0,
intptr_t  n = 0,
intptr_t *  replace_count = nullptr 
)

将当前实例中出现的 n 个指定字符串都替换为另一个指定的字符串, 若 n 为 0 则替换全部项

String String::ReplaceNoCase ( const TCHAR *  pstrFrom,
const TCHAR *  pstrTo,
intptr_t  begin = 0,
intptr_t  n = 0,
intptr_t *  replace_count = nullptr 
) const

返回一个新字符串, 其中当前实例中出现的 n 个指定字符串都替换为另一个指定的字符串并忽略大小写, 若 n 为 0 则替换全部项

String & String::replaceNoCase ( const TCHAR *  pstrFrom,
const TCHAR *  pstrTo,
intptr_t  begin = 0,
intptr_t  n = 0,
intptr_t *  replace_count = nullptr 
)

将当前实例中出现的 n 个指定字符串都替换为另一个指定的字符串并忽略大小写, 若 n 为 0 则替换全部项

String String::Reserve ( intptr_t  length)

Preallocates storage space for holding the specified length of characters, copies the original string and returns new instance of result string

String & String::reserve ( intptr_t  length,
bool  keep = true 
)

Preallocates storage space for holding the specified length of characters, and determines whether to keep the original string or not

String String::Reverse ( ) const

返回此 String 颠倒字符次序后的副本

String & String::reverse ( )

将当前 String 颠倒字符次序

System::String::RLIB_PROPERTY_GET ( const intptr_t  Size,
GetSize   
)

获取字符串缓冲区大小(包括 \0 结尾符大小, in bytes)

System::String::RLIB_PROPERTY_GET ( const intptr_t  Length,
GetLength   
)

获取字符串长度(in TCHARs, 不包括结尾'\0')

System::String::RLIB_PROPERTY_GET ( const intptr_t  CanReadSize,
GetCanReadSize   
)

获取字符串可读取大小(不包含结尾'\0'的大小, in bytes)

void String::SetAt ( intptr_t  nIndex,
TCHAR  ch 
)

设置当前 string 对象中位于指定字符位置(从0开始)的字符

class StringArray* System::String::Split ( const String strSeparator,
bool  removeEmptyEntries = false 
) const

返回的字符串数组包含此实例中的子字符串(由指定字符串的元素分隔)

class StringArray* System::String::Split ( const TCHAR *  strSeparator,
intptr_t  lengthOfSeparator,
intptr_t  averageItemLength,
bool  removeEmptyEntries = false 
) const

返回的字符串数组包含此实例中的子字符串(由指定字符串的元素分隔)

bool System::String::StartsWith ( TCHAR  ) const

确定 String 实例的开头是否与指定的字符匹配

bool System::String::StartsWith ( LPCTSTR  pstr,
intptr_t  length = -1 
) const

确定 String 实例的开头是否与指定的字符串匹配

String String::Substring ( intptr_t  index,
intptr_t  length = -1 
) const

从此实例检索并返回新的子字符串, 子字符串从指定的字符位置(从0开始)开始且具有指定的长度

String & String::substring ( intptr_t  index,
intptr_t  length = -1 
)

从此实例检索子字符串, 子字符串从指定的字符位置(从0开始)开始且具有指定的长度

String String::ToLower ( ) const

返回此 String 转换为小写形式的副本

String & String::toLower ( )

将当前 String 转换为小写形式

String String::ToUpper ( ) const

返回此 String 转换为大写形式的副本

String & String::toUpper ( )

将当前 String 转换为大写形式

String String::Trim ( TCHAR  c = 0) const

返回当前 String 对象移除所有前导指定字符和尾部指定字符后的副本

String & String::trim ( TCHAR  c = 0)

从当前 String 对象移除所有前导指定字符和尾部指定字符

String String::TrimEnd ( TCHAR  c = 0) const

从当前 String 对象移除数组中指定的一组字符的所有尾部指定字符后的副本

String & String::trimEnd ( TCHAR  c = 0)

从当前 String 对象移除数组中指定的一组字符的所有尾部指定字符

String String::TrimStart ( TCHAR  c = 0) const

从当前 String 对象移除数组中指定的一组字符的所有前导指定字符后的副本

String & String::trimStart ( TCHAR  c = 0)

从当前 String 对象移除数组中指定的一组字符的所有前导指定字符

bool String::tryCopy ( LPCTSTR  pstr,
intptr_t  len 
)

尝试将指定数目的字符复制到当前 String 实例, 该方法不会分配新的内存, 空间不足返回false


The documentation for this class was generated from the following files: