diff options
author | Carl Olsson <carl.olsson@gmail.com> | 2015-03-23 08:31:54 +1000 |
---|---|---|
committer | Carl Olsson <carl.olsson@gmail.com> | 2015-03-23 08:31:54 +1000 |
commit | b9bd83e178e6332ee31c6efd084503a80446fd27 (patch) | |
tree | 6c9493e058656a2b96c4c51c4ae6cdf6d3a74dd5 /core/ustring.cpp | |
parent | 817f9debe787fc8001c03407f924f61fd5f0f7ad (diff) | |
parent | c68563aeb46514d35f5ae7b8006f8218c716782e (diff) |
Merge branch 'master' of https://github.com/not-surt/godot into snapping2
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r-- | core/ustring.cpp | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index 497e8f29ed..09d3d95b68 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -482,7 +482,7 @@ void String::erase(int p_pos, int p_chars) { String String::capitalize() const { - String aux=this->camelcase_to_underscore().replace("_"," ").to_lower(); + String aux=this->replace("_"," ").to_lower(); String cap; for (int i=0;i<aux.get_slice_count(" ");i++) { @@ -498,29 +498,6 @@ String String::capitalize() const { return cap; } - - -String String::camelcase_to_underscore() const { - const CharType * cstr = c_str(); - String newString; - const char A = 'A', Z = 'Z'; - int startIndex = 0; - - for ( int i = 1; i < this->size()-1; i++ ) { - bool isCapital = cstr[i] >= A && cstr[i] <= Z; - - if ( isCapital ) { - newString += "_" + this->substr(startIndex, i-startIndex); - startIndex = i; - } - } - - newString += "_" + this->substr(startIndex, this->size()-startIndex); - - return newString; -} - - int String::get_slice_count(String p_splitter) const{ if (empty()) |