summaryrefslogtreecommitdiffstats
path: root/core/ustring.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2019-06-15 23:45:24 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-02-11 11:53:27 +0100
commit9b0dd4f571ff431e23b9097e7f29746f4157be12 (patch)
treeaa18fc6803e8733f8f270666e691153c72b6066d /core/ustring.cpp
parent836c2109a0b1371653e3c82100199dfdabd47da9 (diff)
downloadredot-engine-9b0dd4f571ff431e23b9097e7f29746f4157be12.tar.gz
A lot of progress with canvas rendering, still far from working.
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r--core/ustring.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 8030efcc2b..c4543b89da 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -646,6 +646,17 @@ String String::camelcase_to_underscore(bool lowercase) const {
return lowercase ? new_string.to_lower() : new_string;
}
+String String::get_with_code_lines() const {
+ Vector<String> lines = split("\n");
+ String ret;
+ for (int i = 0; i < lines.size(); i++) {
+ if (i > 0) {
+ ret += "\n";
+ }
+ ret += itos(i + 1) + " " + lines[i];
+ }
+ return ret;
+}
int String::get_slice_count(String p_splitter) const {
if (empty())