diff options
author | kobewi <kobewi4e@gmail.com> | 2022-08-12 16:21:15 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-11-04 15:09:12 +0100 |
commit | 8a47a12207348ad332c4ed5987c0ba432ff5de5a (patch) | |
tree | 9bbefb784ec254802db5b3c117c9db57087c3ac2 /doc | |
parent | 191c8ed12f624ec97b650b2726fed4e8c4bcf04c (diff) |
Add support for empty delimiter in String.split
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/String.xml | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/classes/String.xml b/doc/classes/String.xml index 1ee91b91d2..b0b4f74b46 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -634,11 +634,11 @@ </method> <method name="rsplit" qualifiers="const"> <return type="PackedStringArray" /> - <param index="0" name="delimiter" type="String" /> + <param index="0" name="delimiter" type="String" default="""" /> <param index="1" name="allow_empty" type="bool" default="true" /> <param index="2" name="maxsplit" type="int" default="0" /> <description> - Splits the string by a [param delimiter] string and returns an array of the substrings, starting from right. + Splits the string by a [param delimiter] string and returns an array of the substrings, starting from right. If [param delimiter] is an empty string, each substring will be a single character. The splits in the returned array are sorted in the same order as the original string, from left to right. If [param allow_empty] is [code]true[/code], and there are two adjacent delimiters in the string, it will add an empty string to the array of substrings at this position. If [param maxsplit] is specified, it defines the number of splits to do from the right up to [param maxsplit]. The default value of 0 means that all items are split, thus giving the same result as [method split]. @@ -710,11 +710,11 @@ </method> <method name="split" qualifiers="const"> <return type="PackedStringArray" /> - <param index="0" name="delimiter" type="String" /> + <param index="0" name="delimiter" type="String" default="""" /> <param index="1" name="allow_empty" type="bool" default="true" /> <param index="2" name="maxsplit" type="int" default="0" /> <description> - Splits the string by a [param delimiter] string and returns an array of the substrings. The [param delimiter] can be of any length. + Splits the string by a [param delimiter] string and returns an array of the substrings. The [param delimiter] can be of any length. If [param delimiter] is an empty string, each substring will be a single character. If [param allow_empty] is [code]true[/code], and there are two adjacent delimiters in the string, it will add an empty string to the array of substrings at this position. If [param maxsplit] is specified, it defines the number of splits to do from the left up to [param maxsplit]. The default value of [code]0[/code] means that all items are split. If you need only one element from the array at a specific index, [method get_slice] is a more performant option. |