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

Function sformat

modules/mono/utils/string_utils.cpp:97–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95} // namespace
96
97String sformat(const String &p_text, const String &p1, const String &p2,
98 const String &p3, const String &p4, const String &p5, const String &p6) {
99 if (p_text.length() < 2) {
100 return p_text;
101 }
102
103 String args[6] = { p1, p2, p3, p4, p5, p6 };
104
105 String new_string;
106
107 int findex = 0;
108 int search_from = 0;
109 int result = 0;
110
111 while ((result = sfind(p_text, search_from)) >= 0) {
112 char32_t c = p_text[result + 1];
113
114 int req_index = (c == 's' ? findex++ : c - '0');
115
116 new_string += p_text.substr(search_from, result - search_from);
117 new_string += args[req_index];
118 search_from = result + 2;
119 }
120
121 new_string += p_text.substr(search_from);
122
123 return new_string;
124}
125
126#ifdef TOOLS_ENABLED
127bool is_csharp_keyword(const String &p_name) {

Callers 4

_generate_cs_typeMethod · 0.85
_generate_cs_methodMethod · 0.85
_generate_cs_signalMethod · 0.85

Calls 3

sfindFunction · 0.85
substrMethod · 0.80
lengthMethod · 0.45

Tested by

no test coverage detected