# String String operations ## Function String prototype function provides length reading, search matching, interception, replacement, filling, case conversion and type conversion capabilities. ## API List | API | Description | | ------ | ------ | | [String.len](/en/docs/string/len) | Returns the string length. ASCII strings are measured in bytes; non-ASCII strings are measured in Unicode characters. | | [String.trim](/en/docs/string/trim) | Remove leading and trailing blank characters from the string and return a new string. | | [String.trim_start](/en/docs/string/trim_start) | Remove blank characters at the beginning of the string and return a new string. | | [String.trim_end](/en/docs/string/trim_end) | Remove blank characters from the end of the string and return a new string. | | [String.char_at](/en/docs/string/char_at) | Read the character at the specified character position. | | [String.char_code_at](/en/docs/string/char_code_at) | Read the Unicode code point at the specified character position. | | [String.parse_json](/en/docs/string/parse_json) | Parse JSON string into BT value. | | [String.parse_radix_int](/en/docs/string/parse_radix_int) | Parse integer text according to the specified base. | | [String.parse_radix_str](/en/docs/string/parse_radix_str) | Parses whitespace-delimited byte text into a UTF-8 string according to the specified base. | | [String.concat](/en/docs/string/concat) | Concatenate the current string and all parameters in sequence into a new string. | | [String.ends_with](/en/docs/string/ends_with) | Determine whether the string ends with the specified suffix. | | [String.contains](/en/docs/string/contains) | Determine whether the string contains the specified fragment. | | [String.index_of](/en/docs/string/index_of) | Returns the position where the specified fragment first appears. | | [String.last_index_of](/en/docs/string/last_index_of) | Returns the position of the last occurrence of the specified fragment. | | [String.repeat](/en/docs/string/repeat) | Repeat the current string the number of times. | | [String.replace](/en/docs/string/replace) | Replace matching content in a string. Only the first occurrence of a string pattern is replaced; all matches are replaced when the Regex parameter has the g flag. | | [String.replace_all](/en/docs/string/replace_all) | Replace all matching content in the string. | | [String.search](/en/docs/string/search) | Find the first matching position of a string or regular expression in the current string. | | [String.match](/en/docs/string/match) | Returns string or regular expression matching results. | | [String.slice](/en/docs/string/slice) | Intercept the string according to the starting and ending positions. | | [String.split](/en/docs/string/split) | Split a string by delimiter. | | [String.starts_with](/en/docs/string/starts_with) | Determine whether the string starts with the specified prefix. | | [String.substr](/en/docs/string/substr) | Intercept the string by length starting from the specified position. | | [String.to_lowercase](/en/docs/string/to_lowercase) | Convert a string to lowercase. | | [String.to_uppercase](/en/docs/string/to_uppercase) | Convert a string to uppercase. | | [String.to_number](/en/docs/string/to_number) | Convert a string into a numeric value according to BT relaxed number rules. | | [String.to_string](/en/docs/string/to_string) | Returns the current string itself. | | [String.pad_start](/en/docs/string/pad_start) | Pad the string at the beginning to the target length. | | [String.pad_end](/en/docs/string/pad_end) | Pad the string at the end to the target length. | ## Examples ```bt text = ' BT Lang ' result = text.trim().to_uppercase() // Output: BT LANG print result ``` ## Notes - String methods return new values and do not modify the original string. - HTML escaping, escaping and tag stripping have been migrated to [html library ](/en/docs/html). -The parameters of `char_at` and `char_code_at` are read according to Unicode character subscripts. - Return positions for `index_of`, `last_index_of`, `search` are calculated as UTF-8 byte offsets.