MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / to_camel_case

Method to_camel_case

core/string/ustring.cpp:799–814  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

797}
798
799String String::to_camel_case() const {
800 String words = _separate_compound_words().strip_edges();
801 String ret;
802 for (int i = 0; i < words.get_slice_count(" "); i++) {
803 String slice = words.get_slicec(' ', i);
804 if (slice.length() > 0) {
805 if (i == 0) {
806 slice[0] = _find_lower(slice[0]);
807 } else {
808 slice[0] = _find_upper(slice[0]);
809 }
810 ret += slice;
811 }
812 }
813 return ret;
814}
815
816String String::to_pascal_case() const {
817 String words = _separate_compound_words().strip_edges();

Calls 6

_find_lowerFunction · 0.85
_find_upperFunction · 0.85
strip_edgesMethod · 0.80
get_slice_countMethod · 0.80
get_slicecMethod · 0.80
lengthMethod · 0.45

Tested by

no test coverage detected