\brief 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
| 165 | /// \sa \ref keyworddef for extending existing C++ classes in ChaiScript |
| 166 | /// \sa chaiscript::bootstrap::standard_library::string_type |
| 167 | class string |
| 168 | { |
| 169 | public: |
| 170 | /// \brief Finds the first instance of substr. |
| 171 | /// \code |
| 172 | /// eval> find("abab", "ab") |
| 173 | /// 0 |
| 174 | /// \endcode |
| 175 | int find(string s) const; |
| 176 | |
| 177 | |
| 178 | /// \brief Finds the last instance of substr. |
| 179 | /// \code |
| 180 | /// eval> rfind("abab", "ab") |
| 181 | /// 2 |
| 182 | /// \endcode |
| 183 | int rfind(string s) const; |
| 184 | |
| 185 | /// \brief Finds the first of characters in list in the string. |
| 186 | /// |
| 187 | /// \code |
| 188 | /// eval> find_first_of("abab", "bec") |
| 189 | /// 1 |
| 190 | /// \endcode |
| 191 | int find_first_of(string list) const; |
| 192 | |
| 193 | /// \brief Finds the last of characters in list in the string. |
| 194 | /// |
| 195 | /// \code |
| 196 | /// eval> find_last_of("abab", "bec") |
| 197 | /// 3 |
| 198 | /// \endcode |
| 199 | int find_last_of(string list) const; |
| 200 | |
| 201 | /// \brief Finds the first non-matching character to list in the str string. |
| 202 | /// |
| 203 | /// \code |
| 204 | /// eval> find_first_not_of("abcd", "fec") |
| 205 | /// 0 |
| 206 | /// \endcode |
| 207 | int find_first_not_of(string list) const; |
| 208 | |
| 209 | /// \brief Finds the last non-matching character to list in the list string. |
| 210 | /// |
| 211 | /// \code |
| 212 | /// eval> find_last_not_of("abcd", "fec") |
| 213 | /// 3 |
| 214 | /// \endcode |
| 215 | int find_last_not_of(string list) const; |
| 216 | |
| 217 | /// \brief Removes whitespace from the front of the string, returning a new string |
| 218 | /// |
| 219 | /// \note This function is implemented as a ChaiScript function using the def member function notation. |
| 220 | /// |
| 221 | /// \code |
| 222 | /// eval> ltrim(" bob") |
| 223 | /// bob |
| 224 | /// \endcode |
no outgoing calls