| 95 | } // namespace |
| 96 | |
| 97 | String 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 |
| 127 | bool is_csharp_keyword(const String &p_name) { |
no test coverage detected