String manipulation and test functions. More...

Collaboration diagram for String Functions:

Modules

 String conversion Functions
 String conversion functions.
 
 String name/path Functions
 String manipulation and test functions.
 

Functions

const StringMurl::Util::StaticEmptyString ()
 Get the reference to a static empty string. More...
 
const StringMurl::Util::StaticWhitespaceString ()
 Get the reference to a static whitespace string. More...
 
const StringArrayMurl::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 &parameters)
 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 ( )

◆ StaticWhitespaceString()

const String& Murl::Util::StaticWhitespaceString ( )

Get the reference to a static whitespace string.

The whitespace string contains the characters:

" \t\r\n"
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()

String Murl::Util::PrintToString ( const Char format,
  ... 
)

◆ 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
inputStringThe string to split.
delimiterThe delimiter character.
piecesThe pieces return value.
acceptEmptyIf 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
inputStringThe string to split.
delimiterThe delimiter character.
piecesThe pieces return value.
acceptEmptyIf 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
inputStringThe string to split.
delimitersA string containing all delimiter characters.
piecesThe pieces return value.
acceptEmptyIf 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
inputStringThe string to split.
delimitersA string containing all delimiter characters.
piecesThe pieces return value.
acceptEmptyIf 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
inputStringsThe string array to join.
separatorThe separator string to separate the input strings.
joinEmptyIf 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
inputStringsThe string index to join.
separatorThe separator string to separate the input strings.
joinEmptyIf 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
inputStringThe string to indent.
indentThe number of spaces to indent. If this is negative, the given number of spaces are removed from the beginning of each line, if present.
indentEmptyIf 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
inputStringThe placeholder string.
parametersAn 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
inputStringThe string array to trim.

◆ GetLine()

String Murl::Util::GetLine ( const String inputString,
SInt32 startPos 
)

Get a line from a string.

Parameters
inputStringThe string to get the line from.
startPosThe 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()

String Murl::Util::GetWord ( const String inputString,
SInt32 startPos 
)

Get the next word from a string.

Parameters
inputStringThe string to get the word from.
startPosThe 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()

Bool Murl::Util::HasCppScope ( const String className)

Check if a class name has a "::" part.

Parameters
classNameThe class name string.
Returns
true if the class name contains a "::" part.

◆ GetCppScope()

String Murl::Util::GetCppScope ( const String className)

Get the class name substring before the "::" part.

Parameters
classNameThe class name string.
Returns
The class name substring before the "::" part. If the "::" part is not found an empty string is returned.

◆ StripCppScope()

String Murl::Util::StripCppScope ( const String className)

Get the class name substring behind the "::" part.

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

Bool Murl::Util::HasScope ( const String name)

Check if a name has a dot character.

Parameters
nameThe name string.
Returns
true if the name contains a '.' character.

◆ GetScope()

String Murl::Util::GetScope ( const String name)

Get the substring before the dot character.

Parameters
nameThe name string.
Returns
The name substring before the '.' character. If the '.' character is not found an empty string is returned.

◆ StripScope()

String Murl::Util::StripScope ( const String name)

Get the substring behind the dot character.

Parameters
nameThe name string.
Returns
The name substring behind the '.' character. If the '.' character is not found an empty string is returned.

◆ StripIndex()

Bool Murl::Util::StripIndex ( String name,
UInt32 index,
Bool  trimOutput = true 
)

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
nameThe name string to strip.
indexThe index return value.
trimOutputIf true, leading and trailing whitespaces are removed from the name after stripping.
Returns
true if successful.

◆ StripCount()

Bool Murl::Util::StripCount ( String name,
UInt32 count,
Bool  trimOutput = true 
)

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
nameThe name string to strip.
countThe count return value.
trimOutputIf true, leading and trailing whitespaces are removed from the name after stripping.
Returns
true if successful.

◆ IsIdValid()

Bool Murl::Util::IsIdValid ( const String identifier)

Check if an identifier string is valid.

A valid identifier contains:

  • Alphanumeric characters and '.', '_', '{', '}'.
  • No leading numeric characters.
    Parameters
    identifierThe identifier string to check.
    Returns
    true if the identifier string is valid.

◆ IsNumeric()

Bool Murl::Util::IsNumeric ( const String str)

Check if a string has numeric characters only.

A leading '+' or '-' character is allowed.

Parameters
strThe string to check.
Returns
true if the string has numeric characters only.

◆ IsAlphaNumeric() [1/2]

Bool Murl::Util::IsAlphaNumeric ( const String str)

Check if a string has alphanumeric characters only.

Parameters
strThe string to check.
Returns
true if the string has alphanumeric characters only.

Referenced by Murl::Util::IsPunctuation().

◆ IsDigit()

Bool Murl::Util::IsDigit ( const Char  chr)
inline

Check if a character is a digit character.

Parameters
chrThe character to check.
Returns
true if the character is a digit character.

Referenced by Murl::Util::IsAlphaNumeric(), and Murl::Util::IsHexDigit().

◆ IsAlpha()

Bool Murl::Util::IsAlpha ( const Char  chr)
inline

Check if a character is an alphabetic character.

Parameters
chrThe character to check.
Returns
true if the character is an alphabetic character.

Referenced by Murl::Util::IsAlphaNumeric().

◆ IsAlphaNumeric() [2/2]

Bool Murl::Util::IsAlphaNumeric ( const Char  chr)
inline

Check if a character is an alphanumeric character.

Parameters
chrThe character to check.
Returns
true if the character is an alphanumeric character.

References Murl::Util::IsAlpha(), and Murl::Util::IsDigit().

◆ IsPunctuation()

Bool Murl::Util::IsPunctuation ( const Char  chr)
inline

Check if a character is a punctuation character.

Parameters
chrThe character to check.
Returns
true if the character is a punctuation character.

References Murl::Util::IsAlphaNumeric().

◆ IsSpace()

Bool Murl::Util::IsSpace ( const Char  chr)
inline

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
chrThe character to check.
Returns
true if the character is a spacing character.

◆ IsHexDigit()

Bool Murl::Util::IsHexDigit ( const Char  chr)
inline

Check if a character is a hexadecimal character.

Parameters
chrThe character to check.
Returns
true if the character is a hexadecimal character.

References Murl::Util::IsDigit().

◆ IsControl()

Bool Murl::Util::IsControl ( const Char  chr)
inline

Check if a character is a control character.

Parameters
chrThe character to check.
Returns
true if the character is a control character.


Copyright © 2011-2024 Spraylight GmbH.