diff --git a/doc/classes/String.xml b/doc/classes/String.xml index c7eeb8e9a..f7bef00a9 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -1118,6 +1118,13 @@ + Converts a string containing a decimal number into a [code]double[/code]. The method will stop on the first non-number character except the first [code].[/code] (decimal point), and [code]e[/code] which is used for exponential. + [codeblock] + print("12.3".to_double()) # 12.3 + print("1.2.3".to_double()) # 1.2 + print("12ab3".to_double()) # 12 + print("1e3".to_double()) # 1000 + [/codeblock] @@ -1149,6 +1156,18 @@ Returns the string converted to lowercase. + + + + Converts a string containing a decimal number into a [code]real[/code]. Reals can be either floats or doubles based on how the engine was compiled. By default they are floats. The method will stop on the first non-number character except the first [code].[/code] (decimal point), and [code]e[/code] which is used for exponential. + [codeblock] + print("12.3".to_real()) # 12.3 + print("1.2.3".to_real()) # 1.2 + print("12ab3".to_real()) # 12 + print("1e3".to_real()) # 1000 + [/codeblock] + +