MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / String_UNSAFE_Split

Function String_UNSAFE_Split

src/String.c:73–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73int String_UNSAFE_Split(STRING_REF const cc_string* str, char c, cc_string* subs, int maxSubs) {
74 int beg = 0, end, count, i;
75
76 for (i = 0; i < maxSubs && beg <= str->length; i++)
77 {
78 end = String_IndexOfAt(str, beg, c);
79 if (end == -1 || i == (maxSubs - 1)) end = str->length;
80
81 subs[i] = String_UNSAFE_Substring(str, beg, end - beg);
82 beg = end + 1;
83 }
84
85 count = i;
86 /* If not enough split substrings, make remaining NULL */
87 for (; i < maxSubs; i++) { subs[i] = String_Empty; }
88 return count;
89}
90
91void String_UNSAFE_SplitBy(STRING_REF cc_string* str, char c, cc_string* part) {
92 int idx = String_IndexOf(str, c);

Callers 12

ParseIPv4AddressFunction · 0.85
Options_GetColorFunction · 0.85
Http_ParseHeaderFunction · 0.85
MainScreen_GetVersionFunction · 0.85
Commands_ExecuteFunction · 0.85
ReplaceCommand_ExecuteFunction · 0.85
BlockEditCommand_ExecuteFunction · 0.85
DirectUrl_ClaimsFunction · 0.85

Calls 2

String_IndexOfAtFunction · 0.85
String_UNSAFE_SubstringFunction · 0.85

Tested by

no test coverage detected