summaryrefslogtreecommitdiffstats
path: root/core/ustring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r--core/ustring.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index cd33c276a8..d75c21d16e 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -555,6 +555,42 @@ String String::get_slice(String p_splitter, int p_slice) const {
}
+
+Vector<String> String::split_spaces() const {
+
+ Vector<String> ret;
+ int from=0;
+ int i=0;
+ int len = length();
+ bool inside=false;
+
+ while(true) {
+
+ bool empty=operator[](i)<33;
+
+ if (i==0)
+ inside=!empty;
+
+ if (!empty && !inside) {
+ inside=true;
+ from=i;
+ }
+
+ if (empty && inside) {
+
+ ret.push_back(substr(from,i-from));
+ inside=false;
+ }
+
+ if (i==len)
+ break;
+ i++;
+ }
+
+ return ret;
+
+}
+
Vector<String> String::split(const String &p_splitter,bool p_allow_empty) const {
Vector<String> ret;