|
GameApi 28
Library used by GameApi Builder tool
|
ChaiScript representation of std::string. It is an std::string but only some member are exposed to ChaiScript. More...
#include <chaiscript_prelude_docs.hpp>
Public Member Functions | |
| int | find (string s) const |
| Finds the first instance of substr. | |
| int | rfind (string s) const |
| Finds the last instance of substr. | |
| int | find_first_of (string list) const |
| Finds the first of characters in list in the string. | |
| int | find_last_of (string list) const |
| Finds the last of characters in list in the string. | |
| int | find_first_not_of (string list) const |
| Finds the first non-matching character to list in the str string. | |
| int | find_last_not_of (string list) const |
| Finds the last non-matching character to list in the list string. | |
| string | lstrim () const |
| Removes whitespace from the front of the string, returning a new string. | |
| string | rtrim () const |
| Removes whitespace from the back of the string, returning a new string. | |
| string | trim () const |
| Removes whitespace from the front and back of the string, returning a new string. | |
| const char & | operator[] (int t_index) const |
| Returns the character at the given index in the string, const version. | |
| char & | operator[] (int t_index) |
| Returns the character at the given index in the string. | |
| const char * | c_str () const |
| Returns underlying const char * for C api compatibility. | |
| const char * | data () const |
| Returns a pointer to the raw data in the string. | |
| void | clear () |
| Resets the string to empty. | |
| bool | empty () const |
| Returns true if the string is empty. | |
| int | size () const |
| Returns the size of the string in bytes. | |
| Range | range () |
| Returns an object that implements the Range concept for the characters of this string. | |
| Const_Range | range () const |
| Returns an object that implements the Const_Range concept for the characters of this string. | |
ChaiScript representation of std::string. It is an std::string but only some member are exposed to ChaiScript.
Because the ChaiScript string object is an std::string, it is directly convertible to and from std::string using the chaiscript::boxed_cast and chaiscript::var functions.
With the exception of string::trim, string::rtrim, string::ltrim, all members are direct pass-throughs to the std::string of the same name.
"bob".find("b") and find("bob", "b") are exactly the same. Most examples below follow the second formation of the function calls. | const char * ChaiScript_Language::string::c_str | ( | ) | const |
Returns underlying const char * for C api compatibility.
| void ChaiScript_Language::string::clear | ( | ) |
Resets the string to empty.
| const char * ChaiScript_Language::string::data | ( | ) | const |
Returns a pointer to the raw data in the string.
| bool ChaiScript_Language::string::empty | ( | ) | const |
Returns true if the string is empty.
| int ChaiScript_Language::string::find | ( | string | s | ) | const |
Finds the first instance of substr.
| int ChaiScript_Language::string::find_first_not_of | ( | string | list | ) | const |
Finds the first non-matching character to list in the str string.
| int ChaiScript_Language::string::find_first_of | ( | string | list | ) | const |
Finds the first of characters in list in the string.
| int ChaiScript_Language::string::find_last_not_of | ( | string | list | ) | const |
Finds the last non-matching character to list in the list string.
| int ChaiScript_Language::string::find_last_of | ( | string | list | ) | const |
Finds the last of characters in list in the string.
| string ChaiScript_Language::string::lstrim | ( | ) | const |
Removes whitespace from the front of the string, returning a new string.
| char & ChaiScript_Language::string::operator[] | ( | int | t_index | ) |
Returns the character at the given index in the string.
| const char & ChaiScript_Language::string::operator[] | ( | int | t_index | ) | const |
Returns the character at the given index in the string, const version.
| Range ChaiScript_Language::string::range | ( | ) |
Returns an object that implements the Range concept for the characters of this string.
| Const_Range ChaiScript_Language::string::range | ( | ) | const |
Returns an object that implements the Const_Range concept for the characters of this string.
| int ChaiScript_Language::string::rfind | ( | string | s | ) | const |
Finds the last instance of substr.
| string ChaiScript_Language::string::rtrim | ( | ) | const |
Removes whitespace from the back of the string, returning a new string.
| int ChaiScript_Language::string::size | ( | ) | const |
Returns the size of the string in bytes.
This function normally returns size_t in C++. In ChaiScript the return value is cast to int for ease of use.
| string ChaiScript_Language::string::trim | ( | ) | const |
Removes whitespace from the front and back of the string, returning a new string.
Equivalent to rtrim(ltrim(" bob "));