class
#include <Base/include/Framework/String.hpp>
String
Contents
Public types
-
template<typename T>class Stringifier
-
template<typename T, fsize I>class Stringifier<collection::Array<T, I>>
-
template<typename T>class Stringifier<collection::ArrayList<T>>
-
template<typename K, typename V, typename HashOp>class Stringifier<collection::HashMap<K, V, HashOp>>
-
template<typename T>class Stringifier<collection::List<T>>
-
template<typename K, typename V, template<typename T> class Greater, template<typename T> class Less>class Stringifier<collection::Map<K, V, Greater, Less>>
-
template<>class Stringifier<io::File>
-
template<>class Stringifier<json::Json>
-
template<>class Stringifier<json::Json::Array>
-
template<>class Stringifier<json::Json::Object>
-
template<>class Stringifier<math::Color>
-
template<typename T>class Stringifier<math::Matrix<T>>
- class Stringifier<math::Matrix<T, N, M>>
-
template<typename T>class Stringifier<math::Quaternion<T>>
-
template<typename T, fsize I>class Stringifier<math::Vector<T, I>>
-
template<>class Stringifier<system::DateTime>
Public static functions
- static auto UTF32(const char* utf8char) -> fchar
- static auto UTF8(fchar utf32char) -> String
- static auto FromUTF16(const fchar16* str) -> String
- static auto FromUTF32(const fchar* str) -> String
-
template<typename... Args>static auto Format(const String& format, Args&& ...) -> String
-
template<typename T, typename... Args>static auto Format(const String& format, T&& t, Args && ... args) -> String
-
template<typename T, typename std::enable_if<std::is_class<T>::value>::type* = nullptr>static auto ValueOf(const T& val, const fsize prec = 0) -> String
-
template<typename T, typename std::enable_if<std::is_pointer<T>::value>::type* = nullptr>static auto ValueOf(T val, fsize = 0) -> String
- static auto ValueOf(fint i, fsize prec = 0) -> String
- static auto ValueOf(uint32 i, fsize prec = 0) -> String
- static auto ValueOf(uint64 i, fsize prec = 0) -> String
- static auto ValueOf(int64 i, fsize prec = 0) -> String
- static auto ValueOf(float f, fsize prec = 0) -> String
- static auto ValueOf(double d, fsize prec = 0) -> String
- static auto ValueOf(long double d, fsize prec = 0) -> String
- static auto ValueOf(void* ptr, fsize prec = 0) -> String
- static auto ValueOf(int8 i, fsize = 0) -> String
- static auto ValueOf(uint8 i, fsize = 0) -> String
- static auto ValueOf(int16 i, const fsize = 0) -> String
- static auto ValueOf(uint16 i, const fsize = 0) -> String
- static auto ValueOf(const char* s, const fsize = 0) -> String
- static auto ValueOf(bool b, const fsize = 0) -> String
Constructors, destructors, conversion operators
- String() noexcept
- String(const char* str)
- String(fchar c)
- String(const String& s)
- String(String&& s) noexcept
- ~String()
- BP_DEPRECATED("To check for empty string use String. IsEmpty, to create an empty string use litteral \. This " "constant will be removed in a future version.") static const String Empty
Public functions
- void AddSingleByte(char byte)
- auto ByteAt(const fisize id) const -> char
- auto operator+(const String& other) const -> String
- auto operator+(fchar other) const -> String
- auto operator+=(const String& other) -> String&
- auto operator+=(fchar other) -> String&
- auto operator=(const String& other) -> String&
- auto operator=(String&& other) -> String& noexcept
- auto IsEmpty() const -> bool noexcept
- auto operator==(const String& other) const -> bool
- auto operator!=(const String& other) const -> bool
- auto operator<(const String& other) const -> bool
- auto operator>(const String& other) const -> bool
- auto Replace(const String& search, const String& repby) const -> String
- auto operator[](const fisize id) const -> fchar
- auto operator*() const -> const char*
-
auto ToArray() const -> collection::
Array<char> -
auto ToUTF32() const -> collection::
Array<fchar> -
auto ToUTF16() const -> collection::
Array<fchar16> - auto Len() const -> fisize
- auto Size() const -> fisize
- auto IsNumeric() const -> bool
- auto ToUpper() const -> String
- auto ToLower() const -> String
- auto Reverse() const -> String
- auto IndexOf(const String& str) const -> fisize
- auto LastIndexOf(const String& str) const -> fisize
- auto IndexOf(char c) const -> fisize
- auto LastIndexOf(char c) const -> fisize
- auto IndexOf(fchar c) const -> fisize
- auto LastIndexOf(fchar c) const -> fisize
-
auto Explode(char c) const -> collection::
Array<String> -
auto ExplodeIgnore(char c,
char ignore) const -> collection::
Array<String> -
auto Explode(const String& str) const -> collection::
Array<String> -
auto ExplodeIgnore(const String& str,
const String& ignore) const -> collection::
Array<String> -
auto ExplodeOr(const String& str) const -> collection::
Array<String> - auto StartsWith(const String& other) const -> bool
- auto EndsWith(const String& other) const -> bool
- auto Contains(const String& other) const -> bool
- auto Contains(fchar other) const -> bool
- auto SubLen(const fisize begin, const fisize count = -1) const -> String
- auto Sub(fisize begin, fisize end) const -> String
- auto Sub(fisize begin) const -> String
Function documentation
static String bpf:: String:: FromUTF16(const fchar16* str)
Parameters | |
---|---|
str | array of UTF16 codes with a 0 value at the end |
Returns | High-level string representing the UTF!^16 string given as argument |
Exceptions | |
EvalException | in case the the array of UTF16 code contains invalid characters |
Converts an array of UTF16 code to a high-level string
template<typename... Args>
static String bpf:: String:: Format(const String& format,
Args&& ...)
Template parameters | |
---|---|
Args | parameter types to format |
Parameters | |
format | the format string |
... | the actual parameters to format |
Returns | new formatted string |
Formats a string using a set of parameters and a format. Builds a string using the following formating syntax : '[]' for no format or [<num chars padding>,<allignment (left / right)>,<characters to serve as padding>]
template<typename T, typename... Args>
static String bpf:: String:: Format(const String& format,
T&& t,
Args && ... args)
Template parameters | |
---|---|
T | current type |
Args | parameter types to format |
Parameters | |
format | the format string |
t | current value |
args | the actual parameters to format |
Returns | new formatted string |
Formats a string using a set of parameters and a format. Builds a string using the following formating syntax : '[]' for no format or [<num chars padding>,<allignment (left / right)>,<characters to serve as padding>]
template<typename T, typename std::enable_if<std::is_class<T>::value>::type* = nullptr>
static String bpf:: String:: ValueOf(const T& val,
const fsize prec = 0)
Parameters | |
---|---|
val | value to convert to a string |
prec | precision for numeric types (0 means max precision) |
Returns | string representation of val |
Converts any object to it's string representation by calling the appropriate Stringifier or the built-in ValueOf if it is a scalar
bpf:: String:: String() noexcept
Constructs a new empty string
bpf:: String:: String(const char* str)
Parameters | |
---|---|
str | pointer to an array of bytes containing UTF-8 data |
Constructs a new string from a low-level null-terminated c-string
bpf:: String:: BP_DEPRECATED("To check for empty string use String. IsEmpty,
to create an empty string use litteral \. This " "constant will be removed in a future version.") static const String Empty
Empty string constant
void bpf:: String:: AddSingleByte(char byte)
Parameters | |
---|---|
byte | the byte to append |
Low-level function to adds a single byte at the end of this string This function ignores wether or not byte is part of a UTF8 code StrLen will be incremented of 1 and UnicodeLen will be recalculated accordingly
char bpf:: String:: ByteAt(const fisize id) const
Parameters | |
---|---|
id | the index of the byte to return |
Returns | single byte at index id |
Exceptions | |
IndexException | in case the index is out of bounds |
Returns a byte at a given index
String& bpf:: String:: operator+=(const String& other)
Parameters | |
---|---|
other | the string to append |
Returns | modified string (this) |
Appends a string at the end of this string
String& bpf:: String:: operator+=(fchar other)
Parameters | |
---|---|
other | the UTF32 code to append |
Returns | modified string (this) |
Appends a UTF32 code at the end of this string
bool bpf:: String:: IsEmpty() const noexcept
Returns | true if this string is null or 0 bytes long, false otherwise |
---|
Checks if this string is empty
bool bpf:: String:: operator==(const String& other) const
Parameters | |
---|---|
other | the other string to compare with |
Returns | true if strings are equal, false otherwise |
Compare String
bool bpf:: String:: operator!=(const String& other) const
Parameters | |
---|---|
other | the other string to compare with |
Returns | false if strings are equal, true otherwise |
Compare String
fchar bpf:: String:: operator[](const fisize id) const
Parameters | |
---|---|
id | the offset of the character to get |
Returns | UTF32 code |
Exceptions | |
IndexException | if the index is out of bounds |
Returns a character of this string at offset id
const char* bpf:: String:: operator*() const
Returns | immutable low-level null-terminated c-string |
---|
Returns the data of this string
collection:: Array<char> bpf:: String:: ToArray() const
Returns | array of bytes |
---|
Converts this string to an array of byte
collection:: Array<fchar> bpf:: String:: ToUTF32() const
Returns | array of UTF32 codes |
---|
Converts this string to an array of UTF32 codes
collection:: Array<fchar16> bpf:: String:: ToUTF16() const
Returns | array of UTF16 codes |
---|---|
Exceptions | |
EvalException | in case the the current string contains non-UTF16 encodable characters |
Converts this string to an array of UTF16 codes
bool bpf:: String:: IsNumeric() const
Is this string only composed of numeric chracters
fisize bpf:: String:: LastIndexOf(const String& str) const
Parameters | |
---|---|
str | the string to search for |
Returns | index in this string where the first character in str can be found |
Returns the index of the last occurence of str in this string
fisize bpf:: String:: LastIndexOf(char c) const
Parameters | |
---|---|
c | the character to search for |
Returns | index of character in this string |
Returns the index of the last occurence of c in this
fisize bpf:: String:: LastIndexOf(fchar c) const
Parameters | |
---|---|
c | the UTF32 code to search for |
Returns | index of character in this string |
Returns the index of the last occurence of c in this
collection:: Array<String> bpf:: String:: Explode(char c) const
Parameters | |
---|---|
c | the sperator character |
Returns | array of tokens |
Splits this string using a delimiter
collection:: Array<String> bpf:: String:: ExplodeIgnore(char c,
char ignore) const
Parameters | |
---|---|
c | the seperator character |
ignore | character to identify escape sequences (all characters between two of this ignore char will be interpreted as a single token) |
Returns | array of tokens |
Splits this string using a delimiter
collection:: Array<String> bpf:: String:: Explode(const String& str) const
Parameters | |
---|---|
str | the separator string |
Returns | array of tokens |
Splits this string using a delimiter
collection:: Array<String> bpf:: String:: ExplodeIgnore(const String& str,
const String& ignore) const
Parameters | |
---|---|
str | the separator string |
ignore | string to identify escape sequences (all characters between two of this ignore string will be interpreted as a single token) |
Returns | array of tokens |
Splits this string using a delimiter
collection:: Array<String> bpf:: String:: ExplodeOr(const String& str) const
Parameters | |
---|---|
str | the delimiters each character is treated as a different delimiter |
Returns | array of tokens |
Splits this string using multiple delimiters
bool bpf:: String:: StartsWith(const String& other) const
Parameters | |
---|---|
other | the string to search for |
Returns | true if this string starts with other, false otherwise |
Returns true if this string starts with other