-
Notifications
You must be signed in to change notification settings - Fork 0
class_string
reduz edited this page Feb 23, 2014
·
11 revisions
Category: Built-In Types\
Built-In string class.
- String #basename(****)
- bool #begins_with( String text )
- String #capitalize(****)
- int #casecmp_to( String to )
- bool #empty(****)
- String #extension(****)
- int #find( String what, int from=0 )
- int #find_last( String what )
- int #findn( String what, int from=0 )
- String #get_base_dir(****)
- String #get_file(****)
- int #hash(****)
- int #hex_to_int(****)
- String #insert( int pos, String what )
- bool #is_abs_path(****)
- bool #is_rel_path(****)
- bool #is_valid_float(****)
- bool #is_valid_html_color(****)
- bool #is_valid_identifier(****)
- bool #is_valid_integer(****)
- bool #is_valid_ip_address(****)
- String #left( int pos )
- int #length(****)
- bool #match( String expr )
- bool #matchn( String expr )
- int #nocasecmp_to( String to )
- String #ord_at( int at )
- String #pad_decimals( int digits )
- String #pad_zeros( int digits )
- String #percent_decode(****)
- String #percent_encode(****)
- String #plus_file( String file )
- String #replace( String what, String forwhat )
- String #replacen( String what, String forwhat )
- int #rfind( String what, int from=-1 )
- int #rfindn( String what, int from=-1 )
- String #right( int pos )
- StringArray #split( String divisor, bool allow_empty=True )
- RealArray #split_floats( String divisor, bool allow_empty=True )
- String #strip_edges(****)
- String #substr( int from, int len )
- real #to_float(****)
- int #to_int(****)
- String #to_lower(****)
- String #to_upper(****)
- String #xml_escape(****)
- String #xml_unescape(****)
This is the built in string class (and the one used by GDScript). It supports Unicode and provides all necesary means for string handling. Strings are reference counted and use a copy-on-write approach, so passing them around is cheap in resources.
== basename ==
- String #basename(****) \ If the string is a path to a file, return the path to the file without the extension. == begins_with ==
- bool #begins_with( String text ) \ Return true if the strings begins with the given string. == capitalize ==
- String #capitalize(****) \ Return the string in uppercase. == casecmp_to ==
- int #casecmp_to( String to ) \ Perform a case-sensitive comparison to antoher string, return -1 if less, 0 if equal and +1 if greater. == empty ==
- bool #empty(****) \ Return true if the string is empty. == extension ==
- String #extension(****) \ If the string is a path to a file, return the extension. == find ==
- int #find( String what, int from=0 ) \ Find the first occurence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed. == find_last ==
- int #find_last( String what ) \ Find the last occurence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed. == findn ==
- int #findn( String what, int from=0 ) \ Find the first occurence 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. == get_base_dir ==
- String #get_base_dir(****) \ If the string is a path to a file, return the base directory. == get_file ==
- String #get_file(****) \ If the string is a path to a file, return the file and ignore the base directory. == hash ==
- int #hash(****) \ Hash the string and return a 32 bits integer. == insert ==
- String #insert( int pos, String what ) \ Insert a substring at a given position. == is_abs_path ==
- bool #is_abs_path(****) \ If the string is a path to a file or directory, return true if the path is absolute. == is_rel_path ==
- bool #is_rel_path(****) \ If the string is a path to a file or directory, return true if the path is relative. == left ==
- String #left( int pos ) \ Return an amount of characters from the left of the string. == length ==
- int #length(****) \ Return the length of the string in characters. == match ==
- bool #match( String expr ) \ Do a simple expression matching, using ? and * wildcards. == matchn ==
- bool #matchn( String expr ) \ Do a simple, case insensitive, expression matching, using ? and * wildcards. == nocasecmp_to ==
- int #nocasecmp_to( String to ) \ Perform a case-insensitive comparison to antoher string, return -1 if less, 0 if equal and +1 if greater. == replace ==
- String #replace( String what, String forwhat ) \ Replace occurrences of a substring for different ones inside the string. == replacen ==
- String #replacen( String what, String forwhat ) \ Replace occurrences of a substring for different ones inside the string, but search case-insensitive. == rfind ==
- int #rfind( String what, int from=-1 ) \ Perform a search for a substring, but start from the end of the string instead of the begining. == rfindn ==
- int #rfindn( String what, int from=-1 ) \ Perform a search for a substring, but start from the end of the string instead of the begining. Also search case-insensitive. == right ==
- String #right( int pos ) \ Return the right side of the string from a given position. == split ==
- StringArray #split( String divisor, 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 ",". == split_floats ==
- RealArray #split_floats( String divisor, 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 ",". == strip_edges ==
- String #strip_edges(****) \ Return a copy of the string stripped of any non-printable character at the begining and the end. == to_lower ==
- String #to_lower(****) \ Return the string converted to lowercase. == to_upper ==
- String #to_upper(****) \ Return the string converted to uppercase. == xml_escape ==
- String #xml_escape(****) \ Perform XML escaping on the string. == xml_unescape ==
- String #xml_unescape(****) \ Perform XML un-escaping of the string.