Spinning Topp Logo BlackTopp Studios
inc
Functions | Variables
Mezzanine::StringTools Namespace Reference

This is a utility to help perform all kinds of string related tasks. More...

Functions

String CamelCaseCopy (String Source)
 Create a copy of the String that has the first letter of each word upper case and other letters lower case. More...
 
ColourValue ConvertHexToColourValue (const String &ToConvert)
 Converts a Hex code in a string into a ColourValue. More...
 
Boole ConvertToBool (const String &ToConvert, const Boole Default=false)
 Converts a string into a Boole. More...
 
ColourValue ConvertToColourValue (const String &ToConvert)
 Convert four numbers in a string into a ColourValue. More...
 
String ConvertToHexString (const ColourValue &ToConvert)
 Converts a ColourValue into a string as a Hex code. More...
 
Int16 ConvertToInt16 (const String &ToConvert)
 Converts a string into an Int16. More...
 
Int32 ConvertToInt32 (const String &ToConvert)
 Converts an string into an Int32. More...
 
Int8 ConvertToInt8 (const String &ToConvert)
 Converts a string into an Int8. More...
 
Integer ConvertToInteger (const String &ToConvert)
 Converts a string into an Integer. More...
 
Quaternion ConvertToQuaternion (const String &ToConvert)
 Convert four numbers in a string into a Quaternion. More...
 
Real ConvertToReal (const String &ToConvert)
 Converts a string into a Real. More...
 
template<typename T >
String ConvertToString (const T &ToConvert)
 Converts any into a string. More...
 
String ConvertToString (const Vector2 &ToConvert)
 Converts a Vector2 into a string. More...
 
String ConvertToString (const Vector3 &ToConvert)
 Converts a Vector3 into a string. More...
 
String ConvertToString (const Quaternion &ToConvert)
 Converts a Quaternion into a string. More...
 
String ConvertToString (const ColourValue &ToConvert)
 Converts a ColourValue into a string. More...
 
String ConvertToString (const Input::InputCode &Code, Boole ShiftPressed)
 Converts a Input::InputCode into a string. More...
 
UInt16 ConvertToUInt16 (const String &ToConvert)
 Converts a string into a UInt16. More...
 
UInt32 ConvertToUInt32 (const String &ToConvert)
 Converts a string into a UInt32. More...
 
UInt8 ConvertToUInt8 (const String &ToConvert)
 Converts a string into a UInt8. More...
 
Vector2 ConvertToVector2 (const String &ToConvert)
 Convert two numbers in a string into a Vector2. More...
 
Vector3 ConvertToVector3 (const String &ToConvert)
 Convert three numbers in a string into a Vector3. More...
 
Whole ConvertToWhole (const String &ToConvert)
 Converts a string into an Whole. More...
 
Boole EndsWith (const String &Str, const String &Pattern, const Boole CaseSensitive)
 Checks a String to see if it ends with a specific pattern. More...
 
Boole IsAlphaLetter (const Char8 ToCheck)
 Checks if a character is a lower or upper case letter. More...
 
Boole IsAlphanumeric (const Char8 ToCheck)
 Checks if a character is a letter or digit. More...
 
Boole IsDigit (const Char8 ToCheck)
 Checks if a character is a decimal digit. More...
 
Boole IsHexDigit (const Char8 ToCheck)
 Checks if a character is a hexadecimal digit. More...
 
Boole IsHexLetter (const Char8 ToCheck)
 Checks if a character is a hexadecimal letter. More...
 
Boole IsLowerAlphaLetter (const Char8 ToCheck)
 Checks if a character is a lower-case alphabetic letter. More...
 
Boole IsLowerHexLetter (const Char8 ToCheck)
 Checks if a character is a lower-case hexadecimal letter. More...
 
Boole IsUpperAlphaLetter (const Char8 ToCheck)
 Checks if a character is a upper-case alphabetic letter. More...
 
Boole IsUpperHexLetter (const Char8 ToCheck)
 Checks if a character is a upper-case hexadecimal letter. More...
 
String LowerCaseCopy (String Source)
 Create a copy of the String that is lower case. More...
 
void RemoveDuplicateWhitespaces (String &Source)
 Replaces all instances of multiple consecutive whitespaces with only a single whitespace. More...
 
StringVector Split (const String &Source, const String &Delims=" \t\n", const Whole MaxSplits=0)
 Splits a string into multiple substrings based on the specified delimiters. More...
 
Boole StartsWith (const String &Str, const String &Pattern, const Boole CaseSensitive)
 Checks a String to see if it starts with a specific pattern. More...
 
void ToCamelCase (String &Source)
 Converts the first letter of each word to upper case and all other letters to lower case. More...
 
void ToLowerCase (String &Source)
 Converts all upper case characters in a string to their respective lower case. More...
 
void ToUpperCase (String &Source)
 Converts all lower case characters in a string to their respective upper case. More...
 
void Trim (String &Source, Boole Left=true, Boole Right=true)
 Trims all whitespaces and tabs from a one or both sides of a String. More...
 
String UpperCaseCopy (String Source)
 Create a copy of the String that is upper case. More...
 

Variables

const String Blank = ""
 Convenience String for comparing to return blank Strings where necessary.
 

Detailed Description

This is a utility to help perform all kinds of string related tasks.

Function Documentation

String Mezzanine::StringTools::CamelCaseCopy ( String  Source)

Create a copy of the String that has the first letter of each word upper case and other letters lower case.

Parameters
SourceThe original String to copy.
Returns
Returns a copy of the String that has been modified to be in Camel Case.

Definition at line 221 of file stringtool.cpp.

ColourValue Mezzanine::StringTools::ConvertHexToColourValue ( const String ToConvert)

Converts a Hex code in a string into a ColourValue.

Parameters
ToConvertThe string to be converted.
Returns
Returns a ColourValue populated with the values from the string passed in.

Definition at line 349 of file stringtool.cpp.

Boole Mezzanine::StringTools::ConvertToBool ( const String ToConvert,
const Boole  Default = false 
)

Converts a string into a Boole.

Parameters
ToConvertThe string to be converted to a Boole.
Returns
Returns a Boole with the converted value.

Definition at line 379 of file stringtool.cpp.

ColourValue Mezzanine::StringTools::ConvertToColourValue ( const String ToConvert)

Convert four numbers in a string into a ColourValue.

Parameters
ToConvertThe string to be converted.
Remarks
The string is expected to have a certain format. The format should be "R G B A". If there are not 4 numbers an exception will be thrown.
Returns
Returns a ColourValue populated with the values from the string passed in.

Definition at line 332 of file stringtool.cpp.

String Mezzanine::StringTools::ConvertToHexString ( const ColourValue ToConvert)

Converts a ColourValue into a string as a Hex code.

Parameters
ToConvertThe ColourValue to be converted.
Returns
Returns a string containing the values from the string passed in.

Definition at line 366 of file stringtool.cpp.

Int16 Mezzanine::StringTools::ConvertToInt16 ( const String ToConvert)

Converts a string into an Int16.

Parameters
ToConvertThe string to be converted to an Int16.
Returns
Returns an Int16 with the converted value.

Definition at line 432 of file stringtool.cpp.

Int32 Mezzanine::StringTools::ConvertToInt32 ( const String ToConvert)

Converts an string into an Int32.

Parameters
ToConvertThe string to be converted to an Int32.
Returns
Returns an Int32 with the converted value.

Definition at line 448 of file stringtool.cpp.

Int8 Mezzanine::StringTools::ConvertToInt8 ( const String ToConvert)

Converts a string into an Int8.

Parameters
ToConvertThe string to be converted to an Int8.
Returns
Returns an Int8 with the converted value.

Definition at line 416 of file stringtool.cpp.

Integer Mezzanine::StringTools::ConvertToInteger ( const String ToConvert)

Converts a string into an Integer.

Parameters
ToConvertThe string to be converted to an Integer.
Returns
Returns an Integer with the converted value.

Definition at line 400 of file stringtool.cpp.

Quaternion Mezzanine::StringTools::ConvertToQuaternion ( const String ToConvert)

Convert four numbers in a string into a Quaternion.

Parameters
ToConvertThe string to be converted.
Remarks
The string is expected to have a certain format. The format should be "X Y Z W". If there are not 4 numbers an exception will be thrown.
Returns
Returns a Quaternion populated with the values from the string passed in.

Definition at line 315 of file stringtool.cpp.

Real Mezzanine::StringTools::ConvertToReal ( const String ToConvert)

Converts a string into a Real.

Parameters
ToConvertThe string to be converted to a Real.
Returns
Returns a Real with the converted value.

Definition at line 392 of file stringtool.cpp.

template<typename T >
String Mezzanine::StringTools::ConvertToString ( const T &  ToConvert)

Converts any into a string.

Parameters
ToConvertStream class instance to be converted.
Returns
Returns a string containing the lexicagraphically converted data.

Definition at line 257 of file stringtool.h.

String Mezzanine::StringTools::ConvertToString ( const Vector2 ToConvert)

Converts a Vector2 into a string.

Parameters
ToConvertThe Vector2 to be converted.
Returns
Returns a string containing the values from the Vector2 in "X Y" format.

Definition at line 291 of file stringtool.cpp.

String Mezzanine::StringTools::ConvertToString ( const Vector3 ToConvert)

Converts a Vector3 into a string.

Parameters
ToConvertThe Vector3 to be converted.
Returns
Returns a string containing the values from the Vector3 in "X Y Z" format.

Definition at line 308 of file stringtool.cpp.

String Mezzanine::StringTools::ConvertToString ( const Quaternion ToConvert)

Converts a Quaternion into a string.

Parameters
ToConvertThe Quaternion to be converted.
Returns
Returns a string containing the values from the Quaternion in "X Y Z W" format.

Definition at line 325 of file stringtool.cpp.

String Mezzanine::StringTools::ConvertToString ( const ColourValue ToConvert)

Converts a ColourValue into a string.

Parameters
ToConvertThe ColourValue to be converted.
Returns
Returns a string containing the values from the ColourValue in "R G B A" format.

Definition at line 342 of file stringtool.cpp.

String Mezzanine::StringTools::ConvertToString ( const Input::InputCode Code,
Boole  ShiftPressed 
)

Converts a Input::InputCode into a string.

Parameters
CodeThe input code to be converted.
ShiftPressedWhether or not the shift modifier key has been pressed.
Returns
Returns a string(usually with only one character) containing the converted input code.
Todo:
Get this ( StringTools::ConvertToString ) to support non us keyboards

Definition at line 464 of file stringtool.cpp.

UInt16 Mezzanine::StringTools::ConvertToUInt16 ( const String ToConvert)

Converts a string into a UInt16.

Parameters
ToConvertThe string to be converted to a UInt16.
Returns
Returns a UInt16 with the converted value.

Definition at line 440 of file stringtool.cpp.

UInt32 Mezzanine::StringTools::ConvertToUInt32 ( const String ToConvert)

Converts a string into a UInt32.

Parameters
ToConvertThe string to be converted to a UInt32.
Returns
Returns a UInt32 with the converted value.

Definition at line 456 of file stringtool.cpp.

UInt8 Mezzanine::StringTools::ConvertToUInt8 ( const String ToConvert)

Converts a string into a UInt8.

Parameters
ToConvertThe string to be converted to a UInt8.
Returns
Returns a UInt8 with the converted value.

Definition at line 424 of file stringtool.cpp.

Vector2 Mezzanine::StringTools::ConvertToVector2 ( const String ToConvert)

Convert two numbers in a string into a Vector2.

Parameters
ToConvertThe string to be converted.
Remarks
The string is expected to have a certain format. The format should be "X Y". If there are not 2 numbers an exception will be thrown.
Returns
Returns a Vector2 populated with the values from the string passed in.

Definition at line 281 of file stringtool.cpp.

Vector3 Mezzanine::StringTools::ConvertToVector3 ( const String ToConvert)

Convert three numbers in a string into a Vector3.

Parameters
ToConvertThe string to be converted.
Remarks
The string is expected to have a certain format. The format should be "X Y Z". If there are not 3 numbers an exception will be thrown.
Returns
Returns a Vector3 populated with the values from the string passed in.

Definition at line 298 of file stringtool.cpp.

Whole Mezzanine::StringTools::ConvertToWhole ( const String ToConvert)

Converts a string into an Whole.

Parameters
ToConvertThe string to be converted to an Whole.
Returns
Returns an Whole with the converted value.

Definition at line 408 of file stringtool.cpp.

Boole Mezzanine::StringTools::EndsWith ( const String Str,
const String Pattern,
const Boole  CaseSensitive 
)

Checks a String to see if it ends with a specific pattern.

Parameters
StrThe String to check.
PatternThe sequence to check for at the end of the String.
CaseSensitiveIf false this function will check lower-case copies for the pattern, otherwise the strings will be checked as is.
Returns
Returns true if the string ends with the provided pattern, false otherwise.

Definition at line 247 of file stringtool.cpp.

Boole Mezzanine::StringTools::IsAlphaLetter ( const Char8  ToCheck)

Checks if a character is a lower or upper case letter.

Parameters
ToCheckThe character to be checked.
Returns
Returns true if the character is a lower or upper case letter, false otherwise.

Definition at line 107 of file stringtool.cpp.

Boole Mezzanine::StringTools::IsAlphanumeric ( const Char8  ToCheck)

Checks if a character is a letter or digit.

Parameters
ToCheckThe character to be checked.
Returns
Returns true if the character is a letter or digit, false otherwise.

Definition at line 122 of file stringtool.cpp.

Boole Mezzanine::StringTools::IsDigit ( const Char8  ToCheck)

Checks if a character is a decimal digit.

Parameters
ToCheckThe character to be checked.
Returns
Returns true if the character is a decimal digit, false otherwise.

Definition at line 98 of file stringtool.cpp.

Boole Mezzanine::StringTools::IsHexDigit ( const Char8  ToCheck)

Checks if a character is a hexadecimal digit.

Parameters
ToCheckThe character to be checked.
Returns
Returns true if the character is a hexadecimal digit, false otherwise.

Definition at line 119 of file stringtool.cpp.

Boole Mezzanine::StringTools::IsHexLetter ( const Char8  ToCheck)

Checks if a character is a hexadecimal letter.

Parameters
ToCheckThe character to be checked.
Returns
Returns true if the character is a hexadecimal letter, false otherwise.

Definition at line 116 of file stringtool.cpp.

Boole Mezzanine::StringTools::IsLowerAlphaLetter ( const Char8  ToCheck)

Checks if a character is a lower-case alphabetic letter.

Parameters
ToCheckThe character to be checked.
Returns
Returns true if the character is a lower-case letter, false otherwise.

Definition at line 101 of file stringtool.cpp.

Boole Mezzanine::StringTools::IsLowerHexLetter ( const Char8  ToCheck)

Checks if a character is a lower-case hexadecimal letter.

Parameters
ToCheckThe character to be checked.
Returns
Returns true if the character is a lower-case letter, false otherwise.

Definition at line 110 of file stringtool.cpp.

Boole Mezzanine::StringTools::IsUpperAlphaLetter ( const Char8  ToCheck)

Checks if a character is a upper-case alphabetic letter.

Parameters
ToCheckThe character to be checked.
Returns
Returns true if the character is a upper-case letter, false otherwise.

Definition at line 104 of file stringtool.cpp.

Boole Mezzanine::StringTools::IsUpperHexLetter ( const Char8  ToCheck)

Checks if a character is a upper-case hexadecimal letter.

Parameters
ToCheckThe character to be checked.
Returns
Returns true if the character is a upper-case letter, false otherwise.

Definition at line 113 of file stringtool.cpp.

String Mezzanine::StringTools::LowerCaseCopy ( String  Source)

Create a copy of the String that is lower case.

Parameters
SourceThe original String to copy.
Returns
Returns a copy of the String that has been modified to be in all lower case.

Definition at line 198 of file stringtool.cpp.

void Mezzanine::StringTools::RemoveDuplicateWhitespaces ( String Source)

Replaces all instances of multiple consecutive whitespaces with only a single whitespace.

Parameters
SourceThe String to be altered.

Definition at line 267 of file stringtool.cpp.

StringVector Mezzanine::StringTools::Split ( const String Source,
const String Delims = " \t\n",
const Whole  MaxSplits = 0 
)

Splits a string into multiple substrings based on the specified delimiters.

Parameters
SourceThe String to be split.
DelimsThe characters to look for and use as split points in the source String.
MaxSplitsThe maximum number of splits to perform on this String. Value of zero means unlimited splits.
Returns
Returns a vector containing all the substrings generated from the source String.

Definition at line 155 of file stringtool.cpp.

Boole Mezzanine::StringTools::StartsWith ( const String Str,
const String Pattern,
const Boole  CaseSensitive 
)

Checks a String to see if it starts with a specific pattern.

Parameters
StrThe String to check.
PatternThe sequence to check for at the start of the String.
CaseSensitiveIf false this function will check lower-case copies for the pattern, otherwise the strings will be checked as is.
Returns
Returns true if the String starts with the provided pattern, false otherwise.

Definition at line 227 of file stringtool.cpp.

void Mezzanine::StringTools::ToCamelCase ( String Source)

Converts the first letter of each word to upper case and all other letters to lower case.

Parameters
SourceThe String to be converted.

Definition at line 204 of file stringtool.cpp.

void Mezzanine::StringTools::ToLowerCase ( String Source)

Converts all upper case characters in a string to their respective lower case.

Parameters
SourceThe String to be converted.

Definition at line 193 of file stringtool.cpp.

void Mezzanine::StringTools::ToUpperCase ( String Source)

Converts all lower case characters in a string to their respective upper case.

Parameters
SourceThe String to be converted.

Definition at line 182 of file stringtool.cpp.

void Mezzanine::StringTools::Trim ( String Source,
Boole  Left = true,
Boole  Right = true 
)

Trims all whitespaces and tabs from a one or both sides of a String.

Parameters
SourceThe original string to be trimmed.
LeftWhether or not to trim the left side of the String.
RightWhether or not to trim the right side of the String.

Definition at line 128 of file stringtool.cpp.

String Mezzanine::StringTools::UpperCaseCopy ( String  Source)

Create a copy of the String that is upper case.

Parameters
SourceThe original String to copy.
Returns
Returns a copy of the String that has been modified to be in all upper case.

Definition at line 187 of file stringtool.cpp.