123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680 |
- .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
- .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
- .. _class_String:
- String
- ======
- **Category:** Built-In Types
- Brief Description
- -----------------
- Built-in string class.
- Member Functions
- ----------------
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`bool<class_bool>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`int<class_int>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`float<class_float>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`Vector2<class_vector2>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`Rect2<class_rect2>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`Vector3<class_vector3>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`Matrix32<class_matrix32>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`Plane<class_plane>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`Quat<class_quat>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`AABB<class_aabb>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`Matrix3<class_matrix3>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`Transform<class_transform>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`Color<class_color>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`NodePath<class_nodepath>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`RID<class_rid>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`InputEvent<class_inputevent>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`Dictionary<class_dictionary>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`Array<class_array>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`RawArray<class_rawarray>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`IntArray<class_intarray>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`RealArray<class_realarray>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`StringArray<class_stringarray>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`Vector2Array<class_vector2array>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`Vector3Array<class_vector3array>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`String<class_String_String>` **(** :ref:`ColorArray<class_colorarray>` from **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`basename<class_String_basename>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`begins_with<class_String_begins_with>` **(** :ref:`String<class_string>` text **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`StringArray<class_stringarray>` | :ref:`bigrams<class_String_bigrams>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`c_escape<class_String_c_escape>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`c_unescape<class_String_c_unescape>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`capitalize<class_String_capitalize>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`casecmp_to<class_String_casecmp_to>` **(** :ref:`String<class_string>` to **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`empty<class_String_empty>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`ends_with<class_String_ends_with>` **(** :ref:`String<class_string>` text **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`erase<class_String_erase>` **(** :ref:`int<class_int>` pos, :ref:`int<class_int>` chars **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`extension<class_String_extension>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`find<class_String_find>` **(** :ref:`String<class_string>` what, :ref:`int<class_int>` from=0 **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`find_last<class_String_find_last>` **(** :ref:`String<class_string>` what **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`findn<class_String_findn>` **(** :ref:`String<class_string>` what, :ref:`int<class_int>` from=0 **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`format<class_String_format>` **(** var values, :ref:`String<class_string>` placeholder={_} **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`get_base_dir<class_String_get_base_dir>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`get_file<class_String_get_file>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`hash<class_String_hash>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`hex_to_int<class_String_hex_to_int>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`insert<class_String_insert>` **(** :ref:`int<class_int>` pos, :ref:`String<class_string>` what **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_abs_path<class_String_is_abs_path>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_rel_path<class_String_is_rel_path>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_subsequence_of<class_String_is_subsequence_of>` **(** :ref:`String<class_string>` text **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_subsequence_ofi<class_String_is_subsequence_ofi>` **(** :ref:`String<class_string>` text **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_valid_float<class_String_is_valid_float>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_valid_html_color<class_String_is_valid_html_color>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_valid_identifier<class_String_is_valid_identifier>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_valid_integer<class_String_is_valid_integer>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_valid_ip_address<class_String_is_valid_ip_address>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`json_escape<class_String_json_escape>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`left<class_String_left>` **(** :ref:`int<class_int>` pos **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`length<class_String_length>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`match<class_String_match>` **(** :ref:`String<class_string>` expr **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`matchn<class_String_matchn>` **(** :ref:`String<class_string>` expr **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`RawArray<class_rawarray>` | :ref:`md5_buffer<class_String_md5_buffer>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`md5_text<class_String_md5_text>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`nocasecmp_to<class_String_nocasecmp_to>` **(** :ref:`String<class_string>` to **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`ord_at<class_String_ord_at>` **(** :ref:`int<class_int>` at **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`pad_decimals<class_String_pad_decimals>` **(** :ref:`int<class_int>` digits **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`pad_zeros<class_String_pad_zeros>` **(** :ref:`int<class_int>` digits **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`percent_decode<class_String_percent_decode>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`percent_encode<class_String_percent_encode>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`plus_file<class_String_plus_file>` **(** :ref:`String<class_string>` file **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`replace<class_String_replace>` **(** :ref:`String<class_string>` what, :ref:`String<class_string>` forwhat **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`replacen<class_String_replacen>` **(** :ref:`String<class_string>` what, :ref:`String<class_string>` forwhat **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`rfind<class_String_rfind>` **(** :ref:`String<class_string>` what, :ref:`int<class_int>` from=-1 **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`rfindn<class_String_rfindn>` **(** :ref:`String<class_string>` what, :ref:`int<class_int>` from=-1 **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`right<class_String_right>` **(** :ref:`int<class_int>` pos **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`RawArray<class_rawarray>` | :ref:`sha256_buffer<class_String_sha256_buffer>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`sha256_text<class_String_sha256_text>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`similarity<class_String_similarity>` **(** :ref:`String<class_string>` text **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`StringArray<class_stringarray>` | :ref:`split<class_String_split>` **(** :ref:`String<class_string>` divisor, :ref:`bool<class_bool>` allow_empty=True **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`RealArray<class_realarray>` | :ref:`split_floats<class_String_split_floats>` **(** :ref:`String<class_string>` divisor, :ref:`bool<class_bool>` allow_empty=True **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`strip_edges<class_String_strip_edges>` **(** :ref:`bool<class_bool>` left=True, :ref:`bool<class_bool>` right=True **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`substr<class_String_substr>` **(** :ref:`int<class_int>` from, :ref:`int<class_int>` len **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`RawArray<class_rawarray>` | :ref:`to_ascii<class_String_to_ascii>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`to_float<class_String_to_float>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`to_int<class_String_to_int>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`to_lower<class_String_to_lower>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`to_upper<class_String_to_upper>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`RawArray<class_rawarray>` | :ref:`to_utf8<class_String_to_utf8>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`xml_escape<class_String_xml_escape>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`xml_unescape<class_String_xml_unescape>` **(** **)** |
- +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
- Description
- -----------
- This is the built-in string class (and the one used by GDScript). It supports Unicode and provides all necessary means for string handling. Strings are reference counted and use a copy-on-write approach, so passing them around is cheap in resources.
- Member Function Description
- ---------------------------
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`bool<class_bool>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`int<class_int>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`float<class_float>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`Vector2<class_vector2>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`Rect2<class_rect2>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`Vector3<class_vector3>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`Matrix32<class_matrix32>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`Plane<class_plane>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`Quat<class_quat>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`AABB<class_aabb>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`Matrix3<class_matrix3>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`Transform<class_transform>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`Color<class_color>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`NodePath<class_nodepath>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`RID<class_rid>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`InputEvent<class_inputevent>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`Dictionary<class_dictionary>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`Array<class_array>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`RawArray<class_rawarray>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`IntArray<class_intarray>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`RealArray<class_realarray>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`StringArray<class_stringarray>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`Vector2Array<class_vector2array>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`Vector3Array<class_vector3array>` from **)**
- .. _class_String_String:
- - :ref:`String<class_string>` **String** **(** :ref:`ColorArray<class_colorarray>` from **)**
- .. _class_String_basename:
- - :ref:`String<class_string>` **basename** **(** **)**
- If the string is a path to a file, return the path to the file without the extension.
- .. _class_String_begins_with:
- - :ref:`bool<class_bool>` **begins_with** **(** :ref:`String<class_string>` text **)**
- Return true if the strings begins with the given string.
- .. _class_String_bigrams:
- - :ref:`StringArray<class_stringarray>` **bigrams** **(** **)**
- Return the bigrams (pairs of consecutive letters) of this string.
- .. _class_String_c_escape:
- - :ref:`String<class_string>` **c_escape** **(** **)**
- Return a copy of the string with special characters escaped using the C language standard.
- .. _class_String_c_unescape:
- - :ref:`String<class_string>` **c_unescape** **(** **)**
- Return a copy of the string with escaped characters replaced by their meanings according to the C language standard.
- .. _class_String_capitalize:
- - :ref:`String<class_string>` **capitalize** **(** **)**
- Change the case of some letters. Replace underscores with spaces, convert all letters to lowercase then capitalize first and every letter following the space character. For ``capitalize camelCase mixed_with_underscores`` it will return ``Capitalize Camelcase Mixed With Underscores``.
- .. _class_String_casecmp_to:
- - :ref:`int<class_int>` **casecmp_to** **(** :ref:`String<class_string>` to **)**
- Perform a case-sensitive comparison to another string, return -1 if less, 0 if equal and +1 if greater.
- .. _class_String_empty:
- - :ref:`bool<class_bool>` **empty** **(** **)**
- Return true if the string is empty.
- .. _class_String_ends_with:
- - :ref:`bool<class_bool>` **ends_with** **(** :ref:`String<class_string>` text **)**
- Return true if the strings ends with the given string.
- .. _class_String_erase:
- - void **erase** **(** :ref:`int<class_int>` pos, :ref:`int<class_int>` chars **)**
- Erase ``chars`` characters from the string starting from ``pos``.
- .. _class_String_extension:
- - :ref:`String<class_string>` **extension** **(** **)**
- If the string is a path to a file, return the extension.
- .. _class_String_find:
- - :ref:`int<class_int>` **find** **(** :ref:`String<class_string>` what, :ref:`int<class_int>` from=0 **)**
- Find the first occurrence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
- .. _class_String_find_last:
- - :ref:`int<class_int>` **find_last** **(** :ref:`String<class_string>` what **)**
- Find the last occurrence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
- .. _class_String_findn:
- - :ref:`int<class_int>` **findn** **(** :ref:`String<class_string>` what, :ref:`int<class_int>` from=0 **)**
- Find the first occurrence of a substring but search as case-insensitive, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
- .. _class_String_format:
- - :ref:`String<class_string>` **format** **(** var values, :ref:`String<class_string>` placeholder={_} **)**
- .. _class_String_get_base_dir:
- - :ref:`String<class_string>` **get_base_dir** **(** **)**
- If the string is a path to a file, return the base directory.
- .. _class_String_get_file:
- - :ref:`String<class_string>` **get_file** **(** **)**
- If the string is a path to a file, return the file and ignore the base directory.
- .. _class_String_hash:
- - :ref:`int<class_int>` **hash** **(** **)**
- Hash the string and return a 32 bits integer.
- .. _class_String_hex_to_int:
- - :ref:`int<class_int>` **hex_to_int** **(** **)**
- Convert a string containing an hexadecimal number into an int.
- .. _class_String_insert:
- - :ref:`String<class_string>` **insert** **(** :ref:`int<class_int>` pos, :ref:`String<class_string>` what **)**
- Insert a substring at a given position.
- .. _class_String_is_abs_path:
- - :ref:`bool<class_bool>` **is_abs_path** **(** **)**
- If the string is a path to a file or directory, return true if the path is absolute.
- .. _class_String_is_rel_path:
- - :ref:`bool<class_bool>` **is_rel_path** **(** **)**
- If the string is a path to a file or directory, return true if the path is relative.
- .. _class_String_is_subsequence_of:
- - :ref:`bool<class_bool>` **is_subsequence_of** **(** :ref:`String<class_string>` text **)**
- Check whether this string is a subsequence of the given string.
- .. _class_String_is_subsequence_ofi:
- - :ref:`bool<class_bool>` **is_subsequence_ofi** **(** :ref:`String<class_string>` text **)**
- Check whether this string is a subsequence of the given string, without considering case.
- .. _class_String_is_valid_float:
- - :ref:`bool<class_bool>` **is_valid_float** **(** **)**
- Check whether the string contains a valid float.
- .. _class_String_is_valid_html_color:
- - :ref:`bool<class_bool>` **is_valid_html_color** **(** **)**
- Check whether the string contains a valid color in HTML notation.
- .. _class_String_is_valid_identifier:
- - :ref:`bool<class_bool>` **is_valid_identifier** **(** **)**
- Check whether the string is a valid identifier. As is common in programming languages, a valid identifier may contain only letters, digits and underscores (\_) and the first character may not be a digit.
- .. _class_String_is_valid_integer:
- - :ref:`bool<class_bool>` **is_valid_integer** **(** **)**
- Check whether the string contains a valid integer.
- .. _class_String_is_valid_ip_address:
- - :ref:`bool<class_bool>` **is_valid_ip_address** **(** **)**
- Check whether the string contains a valid IP address.
- .. _class_String_json_escape:
- - :ref:`String<class_string>` **json_escape** **(** **)**
- Return a copy of the string with special characters escaped using the JSON standard.
- .. _class_String_left:
- - :ref:`String<class_string>` **left** **(** :ref:`int<class_int>` pos **)**
- Return an amount of characters from the left of the string.
- .. _class_String_length:
- - :ref:`int<class_int>` **length** **(** **)**
- Return the length of the string in characters.
- .. _class_String_match:
- - :ref:`bool<class_bool>` **match** **(** :ref:`String<class_string>` expr **)**
- Do a simple expression match, where '\*' matches zero or more arbitrary characters and '?' matches any single character except '.'.
- .. _class_String_matchn:
- - :ref:`bool<class_bool>` **matchn** **(** :ref:`String<class_string>` expr **)**
- Do a simple case insensitive expression match, using ? and \* wildcards (see :ref:`match<class_String_match>`).
- .. _class_String_md5_buffer:
- - :ref:`RawArray<class_rawarray>` **md5_buffer** **(** **)**
- Return the MD5 hash of the string as an array of bytes.
- .. _class_String_md5_text:
- - :ref:`String<class_string>` **md5_text** **(** **)**
- Return the MD5 hash of the string as a string.
- .. _class_String_nocasecmp_to:
- - :ref:`int<class_int>` **nocasecmp_to** **(** :ref:`String<class_string>` to **)**
- Perform a case-insensitive comparison to another string, return -1 if less, 0 if equal and +1 if greater.
- .. _class_String_ord_at:
- - :ref:`int<class_int>` **ord_at** **(** :ref:`int<class_int>` at **)**
- Return the character code at position ``at``.
- .. _class_String_pad_decimals:
- - :ref:`String<class_string>` **pad_decimals** **(** :ref:`int<class_int>` digits **)**
- Format a number to have an exact number of ``digits`` after the decimal point.
- .. _class_String_pad_zeros:
- - :ref:`String<class_string>` **pad_zeros** **(** :ref:`int<class_int>` digits **)**
- Format a number to have an exact number of ``digits`` before the decimal point.
- .. _class_String_percent_decode:
- - :ref:`String<class_string>` **percent_decode** **(** **)**
- Decode a percent-encoded string. See :ref:`percent_encode<class_String_percent_encode>`.
- .. _class_String_percent_encode:
- - :ref:`String<class_string>` **percent_encode** **(** **)**
- Percent-encode a string. This is meant to encode parameters in a URL when sending a HTTP GET request and bodies of form-urlencoded POST request.
- .. _class_String_plus_file:
- - :ref:`String<class_string>` **plus_file** **(** :ref:`String<class_string>` file **)**
- If the string is a path, this concatenates ``file`` at the end of the string as a subpath. E.g. ``"this/is".plus_file("path") == "this/is/path"``.
- .. _class_String_replace:
- - :ref:`String<class_string>` **replace** **(** :ref:`String<class_string>` what, :ref:`String<class_string>` forwhat **)**
- Replace occurrences of a substring for different ones inside the string.
- .. _class_String_replacen:
- - :ref:`String<class_string>` **replacen** **(** :ref:`String<class_string>` what, :ref:`String<class_string>` forwhat **)**
- Replace occurrences of a substring for different ones inside the string, but search case-insensitive.
- .. _class_String_rfind:
- - :ref:`int<class_int>` **rfind** **(** :ref:`String<class_string>` what, :ref:`int<class_int>` from=-1 **)**
- Perform a search for a substring, but start from the end of the string instead of the beginning.
- .. _class_String_rfindn:
- - :ref:`int<class_int>` **rfindn** **(** :ref:`String<class_string>` what, :ref:`int<class_int>` from=-1 **)**
- Perform a search for a substring, but start from the end of the string instead of the beginning. Also search case-insensitive.
- .. _class_String_right:
- - :ref:`String<class_string>` **right** **(** :ref:`int<class_int>` pos **)**
- Return the right side of the string from a given position.
- .. _class_String_sha256_buffer:
- - :ref:`RawArray<class_rawarray>` **sha256_buffer** **(** **)**
- .. _class_String_sha256_text:
- - :ref:`String<class_string>` **sha256_text** **(** **)**
- Return the SHA-256 hash of the string as a string.
- .. _class_String_similarity:
- - :ref:`float<class_float>` **similarity** **(** :ref:`String<class_string>` text **)**
- Return the similarity index of the text compared to this string. 1 means totally similar and 0 means totally dissimilar.
- .. _class_String_split:
- - :ref:`StringArray<class_stringarray>` **split** **(** :ref:`String<class_string>` divisor, :ref:`bool<class_bool>` allow_empty=True **)**
- Split the string by a divisor string, return an array of the substrings. Example "One,Two,Three" will return "One","Two","Three" if split by ",".
- .. _class_String_split_floats:
- - :ref:`RealArray<class_realarray>` **split_floats** **(** :ref:`String<class_string>` divisor, :ref:`bool<class_bool>` allow_empty=True **)**
- Split the string in floats by using a divisor string, return an array of the substrings. Example "1,2.5,3" will return 1,2.5,3 if split by ",".
- .. _class_String_strip_edges:
- - :ref:`String<class_string>` **strip_edges** **(** :ref:`bool<class_bool>` left=True, :ref:`bool<class_bool>` right=True **)**
- Return a copy of the string stripped of any non-printable character at the beginning and the end. The optional arguments are used to toggle stripping on the left and right edges respectively.
- .. _class_String_substr:
- - :ref:`String<class_string>` **substr** **(** :ref:`int<class_int>` from, :ref:`int<class_int>` len **)**
- Return part of the string from the position ``from``, with length ``len``.
- .. _class_String_to_ascii:
- - :ref:`RawArray<class_rawarray>` **to_ascii** **(** **)**
- Convert the String (which is a character array) to RawArray (which is an array of bytes). The conversion is speeded up in comparison to to_utf8() with the assumption that all the characters the String contains are only ASCII characters.
- .. _class_String_to_float:
- - :ref:`float<class_float>` **to_float** **(** **)**
- Convert a string, containing a decimal number, into a ``float``.
- .. _class_String_to_int:
- - :ref:`int<class_int>` **to_int** **(** **)**
- Convert a string, containing an integer number, into an ``int``.
- .. _class_String_to_lower:
- - :ref:`String<class_string>` **to_lower** **(** **)**
- Return the string converted to lowercase.
- .. _class_String_to_upper:
- - :ref:`String<class_string>` **to_upper** **(** **)**
- Return the string converted to uppercase.
- .. _class_String_to_utf8:
- - :ref:`RawArray<class_rawarray>` **to_utf8** **(** **)**
- Convert the String (which is an array of characters) to RawArray (which is an array of bytes). The conversion is a bit slower than to_ascii(), but supports all UTF-8 characters. Therefore, you should prefer this function over to_ascii().
- .. _class_String_xml_escape:
- - :ref:`String<class_string>` **xml_escape** **(** **)**
- Return a copy of the string with special characters escaped using the XML standard.
- .. _class_String_xml_unescape:
- - :ref:`String<class_string>` **xml_unescape** **(** **)**
- Return a copy of the string with escaped characters replaced by their meanings according to the XML standard.
|