godot-docs
godot-docs copied to clipboard
Proposed revision of string.split() method
Your Godot version: Alpha 9
Issue description:
From https://github.com/godotengine/godot/issues/61530
Proposed revision of the string.split() documentation.
<description>
Returns the slice of the [Array], from [code]begin[/code] (inclusive) to [code]end[/code] (exclusive), as a new [Array].
The absolute value of [code]begin[/code] and [code]end[/code] will be clamped to the array size, so the default value for [code]end[/code] makes it slice to the size of the array by default (i.e. [code]arr.slice(1)[/code] is a shorthand for [code]arr.slice(1, arr.size())[/code]).
This means that leaving the end parameter empty will return every element to the right of index. For example, [code][0, 1, 2, 3, 4, 5].slice(3) returns [code][3, 4, 5][/code]
If either [code]begin[/code] or [code]end[/code] are negative, they will be relative to the end of the array (i.e. [code]arr.slice(0, -2)[/code] is a shorthand for [code]arr.slice(0, arr.size() - 2)[/code]). Negative and positive indices can be combined, as long as the [code]begin[/code] has a smaller index on the array than [code]end[/code], otherwise an empty array will be returned. For example, [code][0, 1, 2, 3, 4, 5].slice(-4,5) returns [code][1, 2, 3, 4, 5][/code]
If specified, [code]step[/code] is the relative index between source elements. In the case of step being negative, then the index of [code]begin[/code] must be higher than [code]end[/code]. For example, [code][0, 1, 2, 3, 4, 5].slice(5, 1, -2)[/code] returns [code][5, 3][/code]).
If [code]deep[/code] is true, each element will be copied by value rather than by reference.
</description>
URL to the documentation page (if already existing):
https://docs.godotengine.org/en/latest/classes/class_string.html?highlight=string#class-string-method-split
You don't need to open a proposal issue. You can just make the PR and the change will be reviewed.
Superseded by https://github.com/godotengine/godot/pull/68838.