Gorgon Game Engine
String.h File Reference

This file contains string helper functions. More...

Include dependency graph for String.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  CanBeStringified< T_ >
 
struct  CaseInsensitiveLess
 

Namespaces

 Gorgon
 Root namespace for Gorgon Game Engine.
 
 Gorgon::String
 Contains string related functions and classes. This namespace is not yet utf8 aware.
 

Enumerations

enum  LineEnding {
  None, LF, Unix, CR,
  Mac, CRLF, Standard, Windows,
  Mixed
}
 Line ending types. More...
 
enum  QuoteType { None, Single, Double, Both }
 

Functions

bool AppendUnicode (std::string &s, Char c)
 Appends a unicode code point to the string. More...
 
int CaseInsensitiveCompare (const std::string &left, const std::string &right)
 Compares two strings case insensitive. Works similar to strcmp. More...
 
template<class ... P_>
std::string Concat (const P_ &... rest)
 Streams the given parameters into a stringstream and returns the result, effectively concatinating all parameters. More...
 
std::string Extract (std::string &original, char marker, bool trim=false)
 Extracts the part of the string up to the given marker. More...
 
std::string Extract (std::string &original, const std::string &marker, bool trim=false)
 Extracts the part of the string up to the given marker. More...
 
std::string Extract_UseQuotes (std::string &original, char marker, QuoteType quotetype=QuoteType::Both)
 Extracts the part of the string up to the given marker. More...
 
std::string FixLineEndings (const std::string &in, LineEnding type=LineEnding::Standard)
 Fixes/changes line endings. More...
 
template<class T_ >
std::string From (const T_ &item)
 Creates a string from the given data. More...
 
bool InsertUnicode (std::string &s, std::size_t pos, Char c)
 Appends a unicode code point to the string. More...
 
template<class T_ >
std::string Join (const T_ &vec, const std::string &glue=", ")
 Joins a list of strings to a single string using the given glue text. More...
 
std::string PadEnd (std::string str, std::size_t len, char pad=' ')
 Pads the string to the given number of characters from the start. More...
 
std::string PadStart (std::string str, std::size_t len, char pad=' ')
 Pads the string to the given number of characters from the start. More...
 
std::string Replace (std::string str, const std::string &find, const std::string &replace)
 String replace that does not use regex. More...
 
template<class T_ >
T_ To (const std::string &value)
 Converts a string to another type. More...
 
std::string ToLower (std::string str)
 Converts the given string to lowercase. More...
 
std::string ToUpper (std::string str)
 Converts the given string to uppercase. More...
 
std::string Trim (std::string str, const std::string &chars=" \t\n\r")
 Strips whitespace around the given string both from start and end. More...
 
std::string TrimEnd (std::string str, const std::string &chars=" \t\n\r")
 Strips the whitespace at the end of a string. More...
 
std::string TrimStart (std::string str, const std::string &chars=" \t\n\r")
 Strips the whitespace from the start of a string. More...
 
int UnicodeGlyphCount (const std::string &s)
 
int UnicodeUTF8Bytes (Char c)
 
int UTF8Bytes (char c)
 Returns the number of bytes used by the next UTF8 codepoint. More...
 

Detailed Description

This file contains string helper functions.

They work with std::string