🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
字符串相关函数

详细描述

字符串相关函数,包含字符串比较、编码转换等函数。

class  ast::StringViewBasic< _Char >
 

类型定义

using ast::ByString = strings_internal::ByString
 
using ast::ByChar = strings_internal::ByChar
 
using ast::ByAnyChar = strings_internal::ByAnyChar
 
using ast::ByLength = strings_internal::ByLength
 
using ast::ByRepeatedWhitespace = strings_internal::ByRepeatedWhitespace
 
using ast::ByRepeatedChar = strings_internal::ByRepeatedChar
 
using ast::AllowEmpty = strings_internal::AllowEmpty
 
using ast::SkipEmpty = strings_internal::SkipEmpty
 
using ast::SkipWhitespace = strings_internal::SkipWhitespace
 
typedef StringViewBasic< char > ast::StringView
 
typedef StringViewBasic< wchar_t > ast::WStringView
 
typedef StringViewBasic< char16_t > ast::U16StringView
 
typedef StringViewBasic< char32_t > ast::U32StringView
 

函数

AST_UTIL_CAPI errc_t ast::aAnsiToWide (const char *ansi, std::wstring &wide)
 
AST_UTIL_CAPI errc_t ast::aWideToAnsi (const wchar_t *wide, std::string &ansi)
 
errc_t ast::aUtf8ToWide (const char *utf8, std::wstring &wide)
 
AST_UTIL_API std::wstring ast::aUtf8ToWide (StringView utf8)
 
errc_t ast::aWideToUtf8 (const wchar_t *wide, std::string &utf8)
 
AST_UTIL_API std::string ast::aWideToUtf8 (const wchar_t *wide)
 
errc_t ast::aWideToCRT (const wchar_t *wide, std::string &crt)
 
errc_t ast::aCRTToWide (const char *crt, std::wstring &wide)
 
bool ast::aCRTIsUTF8 ()
 
errc_t ast::aUTF8ToCRT (const char *utf8, std::string &crt)
 
template<typename Delimiter >
strings_internal::Splitter< typename strings_internal::SelectDelimiter< Delimiter >::type, strings_internal::AllowEmpty, StringViewast::aStrSplit (StringView text, Delimiter delimiter)
 
template<typename Delimiter , typename Predicate >
strings_internal::Splitter< typename strings_internal::SelectDelimiter< Delimiter >::type, Predicate, StringViewast::aStrSplit (StringView text, Delimiter delimiter, Predicate predicate)
 
template<typename Delimiter >
strings_internal::MaxSplitsImpl< typename strings_internal::SelectDelimiter< Delimiter >::type > ast::MaxSplits (Delimiter delimiter, int limit)
 
bool ast::aEqualsIgnoreCase (StringView piece1, StringView piece2) noexcept
 
StringView ast::aStripAsciiWhitespace (StringView str) noexcept
 
StringView ast::aStripTrailingAsciiWhitespace (StringView str) noexcept
 
StringView ast::aStripLeadingAsciiWhitespace (StringView str) noexcept
 
std::string ast::aAsciiStrToLower (StringView str)
 
std::string ast::aAsciiStrToUpper (StringView str)
 
template<typename _Char >
std::basic_ostream< _Char > & ast::operator<< (std::basic_ostream< _Char > &os, const StringViewBasic< _Char > &sv)
 
StringView ast::operator""_sv (const char *str, size_t len) noexcept
 
WStringView ast::operator""_sv (const wchar_t *str, size_t len) noexcept
 

函数说明

◆ aAnsiToWide()

AST_UTIL_CAPI errc_t ast::aAnsiToWide ( const char * ansi,
std::wstring & wide )

将ANSI编码的字符串转换为宽字符编码

参数
ansi输入ANSI编码的字符串
wide输出宽字符编码的字符串
返回
错误码
警告
仅在Windows平台上实现

◆ aAsciiStrToLower()

std::string ast::aAsciiStrToLower ( StringView str)
inline

将字符串转换为小写

参数
str输入字符串
返回
小写后的字符串

◆ aAsciiStrToUpper()

std::string ast::aAsciiStrToUpper ( StringView str)
inline

将字符串转换为大写

参数
str输入字符串
返回
大写后的字符串

◆ aCRTIsUTF8()

AST_UTIL_CAPI bool ast::aCRTIsUTF8 ( )

检查C语言运行时LC_CTYPE对应的编码是否为UTF-8编码

返回
是否为UTF-8编码

◆ aCRTToWide()

AST_UTIL_CAPI errc_t ast::aCRTToWide ( const char * crt,
std::wstring & wide )

将C语言运行时LC_CTYPE对应的编码的字符串转换为宽字符编码

参数
crt输入C语言运行时LC_CTYPE对应的编码的字符串
wide输出宽字符编码的字符串
返回
错误码

◆ aEqualsIgnoreCase()

bool ast::aEqualsIgnoreCase ( StringView piece1,
StringView piece2 )
inlinenoexcept

比较两个字符串是否相等(不区分大小写)

参数
str1第一个字符串
str2第二个字符串
返回
若相等则返回true,否则返回false

◆ aStripAsciiWhitespace()

StringView ast::aStripAsciiWhitespace ( StringView str)
inlinenoexcept

移除字符串首尾的ASCII空白字符

参数
str输入字符串
返回
移除首尾空白字符后的字符串视图

◆ aStripLeadingAsciiWhitespace()

StringView ast::aStripLeadingAsciiWhitespace ( StringView str)
inlinenoexcept

移除字符串首部的ASCII空白字符

参数
str输入字符串
返回
移除首部空白字符后的字符串视图

◆ aStripTrailingAsciiWhitespace()

StringView ast::aStripTrailingAsciiWhitespace ( StringView str)
inlinenoexcept

移除字符串尾部的ASCII空白字符

参数
str输入字符串
返回
移除尾部空白字符后的字符串视图

◆ aStrSplit() [1/2]

template<typename Delimiter >
strings_internal::Splitter< typename strings_internal::SelectDelimiter< Delimiter >::type, strings_internal::AllowEmpty, StringView > ast::aStrSplit ( StringView text,
Delimiter delimiter )
inline

字符串分割函数

该函数将字符串 text 按照分隔符 delimiter 进行分割。

参数
text- 输入字符串
delimiter- 分隔符
返回值
-分割后的字符串视图迭代器

◆ aStrSplit() [2/2]

template<typename Delimiter , typename Predicate >
strings_internal::Splitter< typename strings_internal::SelectDelimiter< Delimiter >::type, Predicate, StringView > ast::aStrSplit ( StringView text,
Delimiter delimiter,
Predicate predicate )
inline

字符串分割函数

该函数将字符串 text 按照分隔符 delimiter 进行分割, 并根据分割条件 predicate 进行筛选。

参数
text- 输入字符串
delimiter- 分隔符
predicate- 分割条件
返回值
-分割后的字符串视图迭代器

◆ aUTF8ToCRT()

AST_UTIL_CAPI errc_t ast::aUTF8ToCRT ( const char * utf8,
std::string & crt )

将UTF-8编码的字符串转换为C语言运行时LC_CTYPE对应的编码

参数
utf8输入UTF-8编码的字符串
crt输出C语言运行时LC_CTYPE对应的编码的字符串
返回
错误码

◆ aUtf8ToWide()

AST_UTIL_API errc_t ast::aUtf8ToWide ( const char * utf8,
std::wstring & wide )

将UTF-8编码的字符串转换为宽字符编码

参数
utf8输入UTF-8编码的字符串
wide输出宽字符编码的字符串
返回
错误码

◆ aWideToAnsi()

AST_UTIL_CAPI errc_t ast::aWideToAnsi ( const wchar_t * wide,
std::string & ansi )

将宽字符编码的字符串转换为ANSI编码

参数
wide输入宽字符编码的字符串
ansi输出ANSI编码的字符串
返回
错误码
警告
仅在Windows平台上实现

◆ aWideToCRT()

AST_UTIL_CAPI errc_t ast::aWideToCRT ( const wchar_t * wide,
std::string & crt )

将宽字符编码的字符串转换为C语言运行时LC_CTYPE对应的编码

参数
wide输入宽字符编码的字符串
crt输出C语言运行时LC_CTYPE对应的编码的字符串
返回
错误码

◆ aWideToUtf8()

AST_UTIL_API errc_t ast::aWideToUtf8 ( const wchar_t * wide,
std::string & utf8 )

将宽字符编码的字符串转换为UTF-8编码

参数
wide输入宽字符编码的字符串
utf8输出UTF-8编码的字符串
返回
错误码