diff options
author | VolTer <mew.pur.pur@abv.bg> | 2023-02-01 23:29:17 +0100 |
---|---|---|
committer | VolTer <mew.pur.pur@abv.bg> | 2023-02-02 01:34:11 +0100 |
commit | 57e39d0ce9a31364dba6a6174cbfd5a0098d8962 (patch) | |
tree | bf46e4403160be58b712e68cbc9e00a3cf3ab42f /core | |
parent | d01ac9c73686fdf86f083f4d3ee1301bb54d855f (diff) |
Fix String.split() with empty string and delimeter
Diffstat (limited to 'core')
-rw-r--r-- | core/string/ustring.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index b34d9f3271..1b3b070592 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -1157,6 +1157,14 @@ Vector<String> String::split_spaces() const { Vector<String> String::split(const String &p_splitter, bool p_allow_empty, int p_maxsplit) const { Vector<String> ret; + + if (is_empty()) { + if (p_allow_empty) { + ret.push_back(""); + } + return ret; + } + int from = 0; int len = length(); |