ChaiScript
|
ChaiScript representation of std::string. More...
#include <chaiscript_prelude_docs.hpp>
Public Member Functions | |
int | find (string s) const |
Finds the first instance of substr. More... | |
int | rfind (string s) const |
Finds the last instance of substr. More... | |
int | find_first_of (string list) const |
Finds the first of characters in list in the string. More... | |
int | find_last_of (string list) const |
Finds the last of characters in list in the string. More... | |
int | find_first_not_of (string list) const |
Finds the first non-matching character to list in the str string. More... | |
int | find_last_not_of (string list) const |
Finds the last non-matching character to list in the list string. More... | |
string | lstrim () const |
Removes whitespace from the front of the string, returning a new string. More... | |
string | rtrim () const |
Removes whitespace from the back of the string, returning a new string. More... | |
string | trim () const |
Removes whitespace from the front and back of the string, returning a new string. More... | |
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. More... | |
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. 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.
int ChaiScript_Language::string::rfind | ( | string | s | ) | const |
Finds the last instance of substr.
string ChaiScript_Language::string::rtrim | ( | ) | const |
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 |