mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Camel casing being capitalized only happens in the inspector now.
This commit is contained in:
@@ -498,6 +498,27 @@ 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())
|
||||
|
||||
Reference in New Issue
Block a user