Improve the String comparison methods' documentation
This closes https://github.com/godotengine/godot-docs/issues/4096.
(cherry picked from commit a2271ba3bd
)
This commit is contained in:
parent
5766547e33
commit
867b0d57d6
1 changed files with 8 additions and 2 deletions
|
@ -270,7 +270,10 @@
|
|||
<argument index="0" name="to" type="String">
|
||||
</argument>
|
||||
<description>
|
||||
Performs a case-sensitive comparison to another string. Returns [code]-1[/code] if less than, [code]+1[/code] if greater than, or [code]0[/code] if equal.
|
||||
Performs a case-sensitive comparison to another string. Returns [code]-1[/code] if less than, [code]1[/code] if greater than, or [code]0[/code] if equal. "less than" or "greater than" are determined by the [url=https://en.wikipedia.org/wiki/List_of_Unicode_characters]Unicode code points[/code] of each string, which roughly matches the alphabetical order.
|
||||
[b]Behavior with different string lengths:[/b] Returns [code]1[/code] if the "base" string is longer than the [code]to[/code] string or [code]-1[/code] if the "base" string is shorter than the [code]to[/code] string. Keep in mind this length is determined by the number of Unicode codepoints, [i]not[/i] the actual visible characters.
|
||||
[b]Behavior with empty strings:[/b] Returns [code]-1[/code] if the "base" string is empty, [code]1[/code] if the [code]to[/code] string is empty or [code]0[/code] if both strings are empty.
|
||||
To get a boolean result from a string comparison, use the [code]==[/code] operator instead. See also [method nocasecmp_to].
|
||||
</description>
|
||||
</method>
|
||||
<method name="count">
|
||||
|
@ -623,7 +626,10 @@
|
|||
<argument index="0" name="to" type="String">
|
||||
</argument>
|
||||
<description>
|
||||
Performs a case-insensitive comparison to another string. Returns [code]-1[/code] if less than, [code]+1[/code] if greater than, or [code]0[/code] if equal.
|
||||
Performs a case-insensitive comparison to another string. Returns [code]-1[/code] if less than, [code]1[/code] if greater than, or [code]0[/code] if equal. "less than" or "greater than" are determined by the [url=https://en.wikipedia.org/wiki/List_of_Unicode_characters]Unicode code points[/code] of each string, which roughly matches the alphabetical order. Internally, lowercase characters will be converted to uppercase during the comparison.
|
||||
[b]Behavior with different string lengths:[/b] Returns [code]1[/code] if the "base" string is longer than the [code]to[/code] string or [code]-1[/code] if the "base" string is shorter than the [code]to[/code] string. Keep in mind this length is determined by the number of Unicode codepoints, [i]not[/i] the actual visible characters.
|
||||
[b]Behavior with empty strings:[/b] Returns [code]-1[/code] if the "base" string is empty, [code]1[/code] if the [code]to[/code] string is empty or [code]0[/code] if both strings are empty.
|
||||
To get a boolean result from a string comparison, use the [code]==[/code] operator instead. See also [method casecmp_to].
|
||||
</description>
|
||||
</method>
|
||||
<method name="ord_at">
|
||||
|
|
Loading…
Reference in a new issue