summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-01-31 22:56:58 +0100
committerGitHub <noreply@github.com>2020-01-31 22:56:58 +0100
commit188dc714b000bbdb086513dcff3dd4bc4f75a0e7 (patch)
tree42041e4eb6ff59658dc86868a2d6aeb804605efc
parentea3733a0ea261b73ca325fd65d78f083bb77d661 (diff)
parent1de9118c5fee6201ea1e9eb4be9b00867f536520 (diff)
Merge pull request #35801 from Calinou/array-sort-add-example
doc: Add an example for `Array.sort()`
-rw-r--r--doc/classes/Array.xml7
1 files changed, 6 insertions, 1 deletions
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml
index 5f100d918e..89ad8e17db 100644
--- a/doc/classes/Array.xml
+++ b/doc/classes/Array.xml
@@ -322,7 +322,12 @@
<method name="sort">
<description>
Sorts the array.
- [b]Note:[/b] strings are sorted in alphabetical, not natural order.
+ [b]Note:[/b] Strings are sorted in alphabetical order (as opposed to natural order). This may lead to unexpected behavior when sorting an array of strings ending with a sequence of numbers. Consider the following example:
+ [codeblock]
+ var strings = ["string1", "string2", "string10", "string11"]
+ strings.sort()
+ print(strings) # Prints [string1, string10, string11, string2]
+ [/codeblock]
</description>
</method>
<method name="sort_custom">