| 71 | } |
| 72 | |
| 73 | int 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 | |
| 91 | void String_UNSAFE_SplitBy(STRING_REF cc_string* str, char c, cc_string* part) { |
| 92 | int idx = String_IndexOf(str, c); |
no test coverage detected