| 36 | } |
| 37 | |
| 38 | const char* getUnit(const char* string, U32 index, const char* set) |
| 39 | { |
| 40 | U32 sz; |
| 41 | while(index--) |
| 42 | { |
| 43 | if(!*string) |
| 44 | return ""; |
| 45 | sz = dStrcspn(string, set); |
| 46 | if (string[sz] == 0) |
| 47 | return ""; |
| 48 | string += (sz + 1); |
| 49 | } |
| 50 | sz = dStrcspn(string, set); |
| 51 | if (sz == 0) |
| 52 | return ""; |
| 53 | |
| 54 | AssertFatal( sz + 1 < sizeof( _returnBuffer ), "Size of returned string too large for return buffer" ); |
| 55 | |
| 56 | char *ret = &_returnBuffer[0]; |
| 57 | dStrncpy(ret, string, sz); |
| 58 | ret[sz] = '\0'; |
| 59 | return ret; |
| 60 | } |
| 61 | |
| 62 | const char* getUnits(const char* string, S32 startIndex, S32 endIndex, const char* set) |
| 63 | { |
no test coverage detected