![]() |
mFrame
|
字元操作工具類別 更多...
#include <Character.h>
公開型態 | |
enum struct | LineEnding : uint8 { LF , CR , CRLF } |
行結尾類型的列舉類型。 更多... | |
靜態公開方法(Static Public Methods) | |
static bool | isTokenSymbol (char c) |
Check if the character is a separator symbol. | |
static bool | isNextLineSymbol (char c) |
Check if the character is a newline control symbol. | |
static bool | isHexChar (char c) |
判斷字元是否為十六進位字元 | |
static bool | isNumberChar (char c) |
判斷字元是否為數字 | |
static bool | isPrintable (char c) |
判斷字元是否為可列印字元 | |
static bool | isControl (char c) |
判斷字元是否為控制字元 | |
static char | toUpperCase (char ch) |
將單一字元轉換為大寫 | |
static int | toUpperCase (const char *src, char *dst) |
將字串轉換為大寫,當遇到'\0'時停止。 | |
static int | toUpperCase (const char *src, char *dst, int length) |
將字串轉換為大寫,當遇到'\0'或滿足最大轉換長度時停止。 | |
static char | toLowerCase (char ch) |
將單一字元轉換為小寫 | |
static int | toLowerCase (const char *src, char *dst) |
將字串轉換為小寫,當遇到'\0'時停止。 | |
static int | toLowerCase (const char *src, char *dst, int length) |
將字串轉換為小寫,當遇到'\0'或滿足最大轉換長度時停止。 | |
static bool | hexCharToChar (char &result, char highChar, char lowChar) |
將16進制文字轉換至數值。 | |
static bool | hexCharToChar (char &result, char source) |
將16進制文字轉換至數值。 | |
static bool | compare (char src1, char src2) |
字元比較 | |
static bool | compare (const char *str1, const char *str2, int length=-1) |
字符串比較 | |
static bool | compareIgnoreCast (char src1, char src2) |
字元比較且忽略大小寫 | |
static bool | compareIgnoreCast (const char *src1, const char *src2, int length=-1) |
比較字符串且忽略大小寫,限定字符串最大長度為length | |
static bool | compareTokenIgnoreCast (const char *src1, const char *src2, int length=-1) |
比較字符串且忽略大小寫,直到遇到斷落符號或滿足最大長度 | |
static int | length (const char *src) |
取得字符串長度,當遇到'\0'時返回計數 | |
static int | lengthToken (const char *src) |
取得字符串長度,當遇到斷落或滿足最大長度時返回計數 | |
static bool | isHexString (const ufm::lang::Data &source) |
判斷目標是否為16進制字串。 | |
static bool | parseHexString (ufm::lang::Data &result, const ufm::lang::Data &source) |
將二進制字串轉換為位元組資料。 | |
靜態公開屬性 | |
static constexpr char | KEY_NUL = 0x00 |
static constexpr char | KEY_SOH = 0x01 |
static constexpr char | KEY_STX = 0x02 |
static constexpr char | KEY_ETX = 0x03 |
static constexpr char | KEY_EOT = 0x04 |
static constexpr char | KEY_ENQ = 0x05 |
static constexpr char | KEY_ACK = 0x06 |
static constexpr char | KEY_BEL = 0x07 |
static constexpr char | KEY_BS = 0x08 |
static constexpr char | KEY_TAB = 0x09 |
static constexpr char | KEY_LF = 0x0A |
static constexpr char | KEY_VT = 0x0B |
static constexpr char | KEY_FF = 0x0C |
static constexpr char | KEY_CR = 0x0D |
static constexpr char | KEY_SO = 0x0E |
static constexpr char | KEY_SI = 0x0F |
static constexpr char | KEY_DLE = 0x10 |
static constexpr char | KEY_DC1 = 0x11 |
static constexpr char | KEY_DC2 = 0x12 |
static constexpr char | KEY_DC3 = 0x13 |
static constexpr char | KEY_DC4 = 0x14 |
static constexpr char | KEY_NAK = 0x15 |
static constexpr char | KEY_SYN = 0x16 |
static constexpr char | KEY_ETB = 0x17 |
static constexpr char | KEY_CAN = 0x18 |
static constexpr char | KEY_EM = 0x19 |
static constexpr char | KEY_SUB = 0x1A |
static constexpr char | KEY_ESC = 0x1B |
static constexpr char | KEY_FS = 0x1C |
static constexpr char | KEY_GS = 0x1D |
static constexpr char | KEY_RS = 0x1E |
static constexpr char | KEY_US = 0x1F |
static constexpr char | KEY_BACKSPACE = 0x7F |
static constexpr char | KEY_SPACE = 0x20 |
static constexpr char | KEY_EXCLAM = 0x21 |
static constexpr char | KEY_QUOTE = 0x22 |
static constexpr char | KEY_HASH = 0x23 |
static constexpr char | KEY_DOLLAR = 0x24 |
static constexpr char | KEY_PERCENT = 0x25 |
static constexpr char | KEY_AMPERSAND = 0x26 |
static constexpr char | KEY_APOSTROPHE = 0x27 |
static constexpr char | KEY_LEFT_PAREN = 0x28 |
static constexpr char | KEY_RIGHT_PAREN = 0x29 |
static constexpr char | KEY_ASTERISK = 0x2A |
static constexpr char | KEY_PLUS = 0x2B |
static constexpr char | KEY_COMMA = 0x2C |
static constexpr char | KEY_MINUS = 0x2D |
static constexpr char | KEY_PERIOD = 0x2E |
static constexpr char | KEY_SLASH = 0x2F |
static constexpr char | KEY_COLON = 0x3A |
static constexpr char | KEY_SEMICOLON = 0x3B |
static constexpr char | KEY_LESS_THAN = 0x3C |
static constexpr char | KEY_EQUAL = 0x3D |
static constexpr char | KEY_GREATER_THAN = 0x3E |
static constexpr char | KEY_QUESTION = 0x3F |
static constexpr char | KEY_AT = 0x40 |
static constexpr char | KEY_LEFT_BRACKET = 0x5B |
static constexpr char | KEY_BACKSLASH = 0x5C |
static constexpr char | KEY_RIGHT_BRACKET = 0x5D |
static constexpr char | KEY_CARET = 0x5E |
static constexpr char | KEY_UNDERSCORE = 0x5F |
static constexpr char | KEY_GRAVE = 0x60 |
static constexpr char | KEY_LEFT_CURLY = 0x7B |
static constexpr char | KEY_VERTICAL_BAR = 0x7C |
static constexpr char | KEY_RIGHT_CURLY = 0x7D |
static constexpr char | KEY_TILDE = 0x7E |
保護方法(Protected Methods) | |
virtual | ~Character (void) override=default |
銷毀 Character 物件 | |
![]() | |
NonInstantiable (void)=delete | |
禁止實例化 NonInstantiable 類別 | |
NonInstantiable (const NonInstantiable &)=delete | |
禁止複製建構函式 | |
virtual | ~NonInstantiable (void) override=default |
Destroy the Non Instantiable object. | |
NonInstantiable & | operator= (const NonInstantiable &)=delete |
NonInstantiable & | operator= (NonInstantiable &&)=delete |
額外的繼承成員 | |
![]() | |
void * | operator new (size_t n) |
使用運算子 new 分配記憶體 | |
void * | operator new (size_t n, void *p) |
在指定記憶體上調用運算子 new | |
virtual ufm::lang::Object & | getObject (void) override |
取得對應的 Object 物件 | |
void | delay (int milliseconds) const |
延遲指定的毫秒數進行執行緒等待 | |
bool | equals (Object *object) const |
判斷與另一物件是否為相同參照(指標型態比較) | |
bool | equals (Object &object) const |
判斷與另一物件是否為相同參照(參照型態比較) | |
void | wait (void) const |
使當前線程等待直到被通知 | |
bool | wait (int timeout) const |
等待通知或超時 | |
bool | yield (void) const |
讓執行緒讓渡控制權給同優先權的下一個執行緒 | |
int | lock (void) const |
核心鎖定,鎖定期間禁止線程切換 | |
int | unlock (void) const |
核心解鎖 | |
ufm::sys::Thread * | currentThread (void) const |
取得當前執行緒指標 | |
virtual int | hashcode (void) const |
返回對象的哈希碼值。支持這種方法是為了散列表,如HashMap提供的那樣。 | |
![]() | |
virtual | ~Interface (void)=default |
虛擬析構函式 | |
字元操作工具類別
本類別提供:
|
strong |
|
inlinestatic |
字元比較
src1 | 來源1 |
src2 | 來源2 |
|
static |
字符串比較
src1 | 來源1 |
src2 | 來源2 |
length | 比較長度,若為-1則使用字符串長度 |
|
inlinestatic |
字元比較且忽略大小寫
src1 | 來源1 |
src2 | 來源2 |
|
static |
比較字符串且忽略大小寫,限定字符串最大長度為length
src1 | 字符串1 |
src2 | 字符串2 |
length | 比較長度,若為-1則使用字符串長度 |
|
static |
比較字符串且忽略大小寫,直到遇到斷落符號或滿足最大長度
段落符號包括空格、水平製表符、回車、換行或空字元。
src1 | 字符串1 |
src2 | 字符串2 |
length | 比較長度,若為-1則使用字符串長度 |
|
static |
將16進制文字轉換至數值。
result | 儲存目標 |
highChar | 來源高位元字串 |
lowChar | 來源低位元字串 |
|
static |
將16進制文字轉換至數值。
result | 儲存目標 |
source | 來源 |
|
inlinestatic |
判斷字元是否為控制字元
檢查字元是否屬於 ASCII 控制字元範圍 (0x01-0x1F) 或 DEL。
c | 要檢查的字元 |
|
inlinestatic |
判斷字元是否為十六進位字元
檢查字元是否屬於 0-9, a-f, 或 A-F 範圍。
c | 要檢查的字元 |
|
inlinestatic |
判斷目標是否為16進制字串。
source | 來源長度 |
|
inlinestatic |
Check if the character is a newline control symbol.
Determines whether the specified character indicates a line break (carriage return, line feed, or null).
c | The character to check. |
|
inlinestatic |
判斷字元是否為數字
檢查字元是否屬於 '0'-'9' 範圍。
c | 要檢查的字元 |
|
inlinestatic |
判斷字元是否為可列印字元
檢查字元是否位於 ASCII 32 (Space) 到 126 (~) 範圍。
c | 要檢查的字元 |
|
inlinestatic |
Check if the character is a separator symbol.
Determines whether the specified character is a whitespace or control symbol that typically separates tokens (space, horizontal tab, carriage return, line feed, or null).
c | The character to check. |
|
static |
取得字符串長度,當遇到'\0'時返回計數
src | 來源 |
|
static |
取得字符串長度,當遇到斷落或滿足最大長度時返回計數
斷落符號包括空格、水平製表符、回車、換行或空字元。
src | 來源 |
length | 最大長度,若為0則忽略最大長度限制。 |
|
static |
將二進制字串轉換為位元組資料。
result | 結果儲存目標 |
source | 資料來源 |
|
inlinestatic |
將單一字元轉換為小寫
若為大寫字母(A-Z),則轉為對應小寫字母(a-z),否則原樣返回。
ch | 要轉換的大寫字元 |
|
static |
將字串轉換為小寫,當遇到'\0'時停止。
src | 來源。 |
dst | 目標。 |
|
static |
將字串轉換為小寫,當遇到'\0'或滿足最大轉換長度時停止。
src | 來源。 |
dst | 目標。 |
length | 最大轉換長度,若為0則將忽略最大轉換長度,直到發現'\0'為止。 |
|
inlinestatic |
將單一字元轉換為大寫
若為小寫字母(a-z),則轉為對應大寫字母(A-Z),否則原樣返回。
ch | 要轉換的小寫字元 |
|
static |
將字串轉換為大寫,當遇到'\0'時停止。
src | 來源 |
dst | 目標 |
|
static |
將字串轉換為大寫,當遇到'\0'或滿足最大轉換長度時停止。
src | 來源 |
dst | 目標 |
length | 最大轉換長度,若為0則將忽略最大轉換長度,直到發現'\0'為止。 |
|
staticconstexpr |
確認回應(Acknowledge)
|
staticconstexpr |
“&” 和號(Ampersand)
|
staticconstexpr |
“'” 單引號(Apostrophe)
|
staticconstexpr |
“*” 星號(Asterisk)
|
staticconstexpr |
“@” 小老鼠(At Sign)
|
staticconstexpr |
“\” 反斜杠(Backslash)
|
staticconstexpr |
刪除(Delete)
|
staticconstexpr |
鈴聲(Bell)
|
staticconstexpr |
退格(Backspace)
|
staticconstexpr |
取消(Cancel)
|
staticconstexpr |
“^” 插入符號(Caret)
|
staticconstexpr |
“:” 冒號(Colon)
|
staticconstexpr |
“,” 逗號(Comma)
|
staticconstexpr |
回車(Carriage Return)
|
staticconstexpr |
裝置控制 1(Device Control 1)
|
staticconstexpr |
裝置控制 2(Device Control 2)
|
staticconstexpr |
裝置控制 3(Device Control 3)
|
staticconstexpr |
裝置控制 4(Device Control 4)
|
staticconstexpr |
資料連結轉義(Data Link Escape)
|
staticconstexpr |
“$” 美元符號(Dollar Sign)
|
staticconstexpr |
介質結束(End of Medium)
|
staticconstexpr |
請求(Enquiry)
|
staticconstexpr |
傳輸結束(End of Transmission)
|
staticconstexpr |
“=” 等於號(Equal Sign)
|
staticconstexpr |
脫逸(Escape)
|
staticconstexpr |
區塊傳輸結束(End of Block)
|
staticconstexpr |
本文結束(End of Text)
|
staticconstexpr |
“!” 感嘆號(Exclamation Mark)
|
staticconstexpr |
換頁(Form Feed)
|
staticconstexpr |
文件分隔符(File Separator)
|
staticconstexpr |
“`” 重音符號(Grave Accent)
|
staticconstexpr |
“>” 大於號(Greater Than)
|
staticconstexpr |
群組分隔符(Group Separator)
|
staticconstexpr |
“::” 井號(Hash)
|
staticconstexpr |
“[” 左中括號(Left Bracket)
|
staticconstexpr |
“{” 左大括號(Left Curly Brace)
|
staticconstexpr |
“(” 左括號(Left Parenthesis)
|
staticconstexpr |
“<” 小於號(Less Than)
|
staticconstexpr |
換行(Line Feed)
|
staticconstexpr |
“-” 減號(Minus)
|
staticconstexpr |
否定回應(Negative Acknowledge)
|
staticconstexpr |
空字元(Null)
|
staticconstexpr |
“” 百分號(Percent Sign)
|
staticconstexpr |
“.” 句號(Period)
|
staticconstexpr |
“+” 加號(Plus Sign)
|
staticconstexpr |
“?” 問號(Question Mark)
|
staticconstexpr |
“"” 雙引號(Double Quote)
|
staticconstexpr |
“]” 右中括號(Right Bracket)
|
staticconstexpr |
“}” 右大括號(Right Curly Brace)
|
staticconstexpr |
“)” 右括號(Right Parenthesis)
|
staticconstexpr |
記錄分隔符(Record Separator)
|
staticconstexpr |
“;” 分號(Semicolon)
|
staticconstexpr |
移入(Shift In)
|
staticconstexpr |
“/ ”斜杠(Slash)
|
staticconstexpr |
移出(Shift Out)
|
staticconstexpr |
標題開始(Start of Header)
|
staticconstexpr |
“ ” 空格(Space)
|
staticconstexpr |
本文開始(Start of Text)
|
staticconstexpr |
替換(Substitute)
|
staticconstexpr |
同步空閒(Synchronous Idle)
|
staticconstexpr |
水平製表符(Horizontal Tab)
|
staticconstexpr |
“~” 波浪號(Tilde)
|
staticconstexpr |
“_” 下劃線(Underscore)
|
staticconstexpr |
單元分隔符(Unit Separator)
|
staticconstexpr |
“|” 豎線(Vertical Bar)
|
staticconstexpr |
垂直製表符(Vertical Tab)