String manipulation and test functions. More...
Modules | |
String conversion Functions | |
String conversion functions. | |
String name/path Functions | |
String manipulation and test functions. | |
Functions | |
const String & | Murl::Util::StaticEmptyString () |
Get the reference to a static empty string. More... | |
const String & | Murl::Util::StaticWhitespaceString () |
Get the reference to a static whitespace string. More... | |
const StringArray & | Murl::Util::StaticEmptyStringArray () |
Get the reference to a static empty string array. More... | |
String | Murl::Util::PrintToString (const Char *format,...) |
Print formatted variadic arguments into string. More... | |
UInt32 | Murl::Util::SplitString (const String &inputString, Char delimiter, StringArray &pieces, Bool acceptEmpty=false) |
Split a string into pieces using a given delimiter, the pieces are stored in a string array. More... | |
UInt32 | Murl::Util::SplitString (const String &inputString, Char delimiter, StringIndex &pieces, Bool acceptEmpty=false) |
Split a string into pieces using a given delimiter, the pieces are stored in a string index. More... | |
UInt32 | Murl::Util::SplitString (const String &inputString, const String &delimiters, StringArray &pieces, Bool acceptEmpty=false) |
Split a string into pieces using a given set of delimiters, the pieces are stored in a string array. More... | |
UInt32 | Murl::Util::SplitString (const String &inputString, const String &delimiters, StringIndex &pieces, Bool acceptEmpty=false) |
Split a string into pieces using a given set of delimiters, the pieces are stored in a string index. More... | |
String | Murl::Util::JoinStringArray (const StringArray &inputStrings, const String &separator, Bool joinEmpty=false) |
Join all strings from a string array. More... | |
String | Murl::Util::JoinStringIndex (const StringIndex &inputStrings, const String &separator, Bool joinEmpty=false) |
Join all strings from a string index. More... | |
String | Murl::Util::IndentString (const String &inputString, SInt32 indent, Bool indentEmpty=false) |
Indent a (multi-line) string by a given number of white spaces. More... | |
String | Murl::Util::FillInParameters (const String &inputString, const StringArray ¶meters) |
Fill in a set of given parameters into a placeholder string. More... | |
void | Murl::Util::TrimStringArray (StringArray &inputString) |
Trim all strings in a string array. More... | |
String | Murl::Util::GetLine (const String &inputString, SInt32 &startPos) |
Get a line from a string. More... | |
String | Murl::Util::GetWord (const String &inputString, SInt32 &startPos) |
Get the next word from a string. More... | |
Bool | Murl::Util::HasCppScope (const String &className) |
Check if a class name has a "::" part. More... | |
String | Murl::Util::GetCppScope (const String &className) |
Get the class name substring before the "::" part. More... | |
String | Murl::Util::StripCppScope (const String &className) |
Get the class name substring behind the "::" part. More... | |
Bool | Murl::Util::HasScope (const String &name) |
Check if a name has a dot character. More... | |
String | Murl::Util::GetScope (const String &name) |
Get the substring before the dot character. More... | |
String | Murl::Util::StripScope (const String &name) |
Get the substring behind the dot character. More... | |
Bool | Murl::Util::StripIndex (String &name, UInt32 &index, Bool trimOutput=true) |
Strip the index part from a name and get the index value. More... | |
Bool | Murl::Util::StripCount (String &name, UInt32 &count, Bool trimOutput=true) |
Strip the count part from a name and get its value. More... | |
Bool | Murl::Util::IsIdValid (const String &identifier) |
Check if an identifier string is valid. More... | |
Bool | Murl::Util::IsNumeric (const String &str) |
Check if a string has numeric characters only. More... | |
Bool | Murl::Util::IsAlphaNumeric (const String &str) |
Check if a string has alphanumeric characters only. More... | |
Bool | Murl::Util::IsDigit (const Char chr) |
Check if a character is a digit character. More... | |
Bool | Murl::Util::IsAlpha (const Char chr) |
Check if a character is an alphabetic character. More... | |
Bool | Murl::Util::IsAlphaNumeric (const Char chr) |
Check if a character is an alphanumeric character. More... | |
Bool | Murl::Util::IsPunctuation (const Char chr) |
Check if a character is a punctuation character. More... | |
Bool | Murl::Util::IsSpace (const Char chr) |
Check if a character is a spacing character. More... | |
Bool | Murl::Util::IsHexDigit (const Char chr) |
Check if a character is a hexadecimal character. More... | |
Bool | Murl::Util::IsControl (const Char chr) |
Check if a character is a control character. More... | |
Detailed Description
String manipulation and test functions.
Function Documentation
◆ StaticEmptyString()
const String& Murl::Util::StaticEmptyString | ( | ) |
Get the reference to a static empty string.
- Returns
- The reference to a static empty string.
Referenced by Murl::Enum< EnumType >::GetEnumNameByIndex(), Murl::Enum< EnumType >::GetEnumNameByValue(), Murl::Logic::GraphNodeT< NodeType >::GetId(), and Murl::Util::ClassInfoRegistry< ClassInfoType >::GetKeyAt().
◆ StaticWhitespaceString()
const String& Murl::Util::StaticWhitespaceString | ( | ) |
Get the reference to a static whitespace string.
The whitespace string contains the characters:
- Returns
- The reference to a static whitespace string.
◆ StaticEmptyStringArray()
const StringArray& Murl::Util::StaticEmptyStringArray | ( | ) |
Get the reference to a static empty string array.
- Returns
- The reference to a static empty string array.
◆ PrintToString()
Print formatted variadic arguments into string.
- Parameters
-
format The format string. ... The variadic arguments.
- Returns
- The string with the printed arguments.
Referenced by Murl::Debug::Error(), Murl::Math::Cone< DataType >::ToString(), Murl::Math::Cylinder< DataType >::ToString(), Murl::Math::Matrix< DataType >::ToString(), Murl::Math::Plane< DataType >::ToString(), Murl::Math::Quaternion< DataType >::ToString(), Murl::Math::Rectangle< DataType >::ToString(), Murl::Math::Sphere< DataType >::ToString(), and Murl::Math::Vector< DataType >::ToString().
◆ SplitString() [1/4]
UInt32 Murl::Util::SplitString | ( | const String & | inputString, |
Char | delimiter, | ||
StringArray & | pieces, | ||
Bool | acceptEmpty = false |
||
) |
Split a string into pieces using a given delimiter, the pieces are stored in a string array.
- Parameters
-
inputString The string to split. delimiter The delimiter character. pieces The pieces return value. acceptEmpty If true, also empty pieces are accepted, i.e. subsequent pieces are considered to be separated by a single delimiter only.
- Returns
- The number of pieces.
◆ SplitString() [2/4]
UInt32 Murl::Util::SplitString | ( | const String & | inputString, |
Char | delimiter, | ||
StringIndex & | pieces, | ||
Bool | acceptEmpty = false |
||
) |
Split a string into pieces using a given delimiter, the pieces are stored in a string index.
- Parameters
-
inputString The string to split. delimiter The delimiter character. pieces The pieces return value. acceptEmpty If true, also empty pieces are accepted, i.e. subsequent pieces are considered to be separated by a single delimiter only.
- Returns
- The number of pieces.
◆ SplitString() [3/4]
UInt32 Murl::Util::SplitString | ( | const String & | inputString, |
const String & | delimiters, | ||
StringArray & | pieces, | ||
Bool | acceptEmpty = false |
||
) |
Split a string into pieces using a given set of delimiters, the pieces are stored in a string array.
- Parameters
-
inputString The string to split. delimiters A string containing all delimiter characters. pieces The pieces return value. acceptEmpty If true, also empty pieces are accepted, i.e. subsequent pieces are considered to be separated by a single delimiter only.
- Returns
- The number of pieces.
◆ SplitString() [4/4]
UInt32 Murl::Util::SplitString | ( | const String & | inputString, |
const String & | delimiters, | ||
StringIndex & | pieces, | ||
Bool | acceptEmpty = false |
||
) |
Split a string into pieces using a given set of delimiters, the pieces are stored in a string index.
- Parameters
-
inputString The string to split. delimiters A string containing all delimiter characters. pieces The pieces return value. acceptEmpty If true, also empty pieces are accepted, i.e. subsequent pieces are considered to be separated by a single delimiter only.
- Returns
- The number of pieces.
◆ JoinStringArray()
String Murl::Util::JoinStringArray | ( | const StringArray & | inputStrings, |
const String & | separator, | ||
Bool | joinEmpty = false |
||
) |
Join all strings from a string array.
- Parameters
-
inputStrings The string array to join. separator The separator string to separate the input strings. joinEmpty If true, also empty strings are added from the input strings.
- Returns
- The joined string.
◆ JoinStringIndex()
String Murl::Util::JoinStringIndex | ( | const StringIndex & | inputStrings, |
const String & | separator, | ||
Bool | joinEmpty = false |
||
) |
Join all strings from a string index.
- Parameters
-
inputStrings The string index to join. separator The separator string to separate the input strings. joinEmpty If true, also empty strings are added from the input strings.
- Returns
- The joined string.
◆ IndentString()
String Murl::Util::IndentString | ( | const String & | inputString, |
SInt32 | indent, | ||
Bool | indentEmpty = false |
||
) |
Indent a (multi-line) string by a given number of white spaces.
- Parameters
-
inputString The string to indent. indent The number of spaces to indent. If this is negative, the given number of spaces are removed from the beginning of each line, if present. indentEmpty If false, empty lines are not processed (default).
- Returns
- The processed string.
◆ FillInParameters()
String Murl::Util::FillInParameters | ( | const String & | inputString, |
const StringArray & | parameters | ||
) |
Fill in a set of given parameters into a placeholder string.
A placeholder is represented by a zero-based integer within curly braces, e.g. "{0}", "{7}" or "{42}" (without quotes). The integer represents the index into the given parameters array.
- Parameters
-
inputString The placeholder string. parameters An array of string holding the individual parameters.
- Returns
- The processed string.
◆ TrimStringArray()
void Murl::Util::TrimStringArray | ( | StringArray & | inputString | ) |
Trim all strings in a string array.
Trim white spaces from left and right for each string in the array.
- Parameters
-
inputString The string array to trim.
◆ GetLine()
Get a line from a string.
- Parameters
-
inputString The string to get the line from. startPos The start position to get the line from. The start position is set to the beginning of the next line or to -1 if the end of the input string is reached.
- Returns
- The line string.
◆ GetWord()
Get the next word from a string.
- Parameters
-
inputString The string to get the word from. startPos The start position to get the word from. The start position is set to the beginning of the next word or to -1 if the end of the input string is reached.
- Returns
- The word string.
◆ HasCppScope()
Check if a class name has a "::" part.
- Parameters
-
className The class name string.
- Returns
- true if the class name contains a "::" part.
◆ GetCppScope()
Get the class name substring before the "::" part.
- Parameters
-
className The class name string.
- Returns
- The class name substring before the "::" part. If the "::" part is not found an empty string is returned.
◆ StripCppScope()
Get the class name substring behind the "::" part.
- Parameters
-
className The class name string.
- Returns
- The class name substring behind the "::" part. If the "::" part is not found an empty string is returned.
Referenced by Murl::Util::ClassInfoRegistry< ClassInfoType >::Register(), and Murl::Util::ClassInfoRegistry< ClassInfoType >::Unregister().
◆ HasScope()
Check if a name has a dot character.
- Parameters
-
name The name string.
- Returns
- true if the name contains a '.' character.
◆ GetScope()
Get the substring before the dot character.
- Parameters
-
name The name string.
- Returns
- The name substring before the '.' character. If the '.' character is not found an empty string is returned.
◆ StripScope()
Get the substring behind the dot character.
- Parameters
-
name The name string.
- Returns
- The name substring behind the '.' character. If the '.' character is not found an empty string is returned.
◆ StripIndex()
Strip the index part from a name and get the index value.
For example, the input string "param[7]" will be split so that the "name" variable contains the string "param", and index is set to 7.
- Parameters
-
name The name string to strip. index The index return value. trimOutput If true, leading and trailing whitespaces are removed from the name after stripping.
- Returns
- true if successful.
◆ StripCount()
Strip the count part from a name and get its value.
For example, the input string "param7" will be split so that the "name" variable contains the string "param", and count is set to 7.
- Parameters
-
name The name string to strip. count The count return value. trimOutput If true, leading and trailing whitespaces are removed from the name after stripping.
- Returns
- true if successful.
◆ IsIdValid()
Check if an identifier string is valid.
A valid identifier contains:
- Alphanumeric characters and '.', '_', '{', '}'.
- No leading numeric characters.
- Parameters
-
identifier The identifier string to check.
- Returns
- true if the identifier string is valid.
◆ IsNumeric()
Check if a string has numeric characters only.
A leading '+' or '-' character is allowed.
- Parameters
-
str The string to check.
- Returns
- true if the string has numeric characters only.
◆ IsAlphaNumeric() [1/2]
Check if a string has alphanumeric characters only.
- Parameters
-
str The string to check.
- Returns
- true if the string has alphanumeric characters only.
Referenced by Murl::Util::IsPunctuation().
◆ IsDigit()
Check if a character is a digit character.
- Parameters
-
chr The character to check.
- Returns
- true if the character is a digit character.
Referenced by Murl::Util::IsAlphaNumeric(), and Murl::Util::IsHexDigit().
◆ IsAlpha()
Check if a character is an alphabetic character.
- Parameters
-
chr The character to check.
- Returns
- true if the character is an alphabetic character.
Referenced by Murl::Util::IsAlphaNumeric().
◆ IsAlphaNumeric() [2/2]
Check if a character is an alphanumeric character.
- Parameters
-
chr The character to check.
- Returns
- true if the character is an alphanumeric character.
References Murl::Util::IsAlpha(), and Murl::Util::IsDigit().
◆ IsPunctuation()
Check if a character is a punctuation character.
- Parameters
-
chr The character to check.
- Returns
- true if the character is a punctuation character.
References Murl::Util::IsAlphaNumeric().
◆ IsSpace()
Check if a character is a spacing character.
A whitespace is a space, form feed '\f', newline '\n', carriage return '\r', vertical tabulator '\v' or horizontal tabulator '\t' character.
- Parameters
-
chr The character to check.
- Returns
- true if the character is a spacing character.
◆ IsHexDigit()
Check if a character is a hexadecimal character.
- Parameters
-
chr The character to check.
- Returns
- true if the character is a hexadecimal character.
References Murl::Util::IsDigit().