| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkString_DEFINED | 10 #ifndef SkString_DEFINED |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 | 30 |
| 31 bool SkStrEndsWith(const char string[], const char suffixStr[]); | 31 bool SkStrEndsWith(const char string[], const char suffixStr[]); |
| 32 bool SkStrEndsWith(const char string[], const char suffixChar); | 32 bool SkStrEndsWith(const char string[], const char suffixChar); |
| 33 | 33 |
| 34 int SkStrStartsWithOneOf(const char string[], const char prefixes[]); | 34 int SkStrStartsWithOneOf(const char string[], const char prefixes[]); |
| 35 | 35 |
| 36 static int SkStrFind(const char string[], const char substring[]) { | 36 static int SkStrFind(const char string[], const char substring[]) { |
| 37 const char *first = strstr(string, substring); | 37 const char *first = strstr(string, substring); |
| 38 if (NULL == first) return -1; | 38 if (NULL == first) return -1; |
| 39 return SkToS32(first - &string[0]); | 39 return SkToInt(first - &string[0]); |
| 40 } | 40 } |
| 41 | 41 |
| 42 static int SkStrFindLastOf(const char string[], const char subchar) { | 42 static int SkStrFindLastOf(const char string[], const char subchar) { |
| 43 const char* last = strrchr(string, subchar); | 43 const char* last = strrchr(string, subchar); |
| 44 if (NULL == last) return -1; | 44 if (NULL == last) return -1; |
| 45 return SkToS32(last - &string[0]); | 45 return SkToInt(last - &string[0]); |
| 46 } | 46 } |
| 47 | 47 |
| 48 static bool SkStrContains(const char string[], const char substring[]) { | 48 static bool SkStrContains(const char string[], const char substring[]) { |
| 49 SkASSERT(string); | 49 SkASSERT(string); |
| 50 SkASSERT(substring); | 50 SkASSERT(substring); |
| 51 return (-1 != SkStrFind(string, substring)); | 51 return (-1 != SkStrFind(string, substring)); |
| 52 } | 52 } |
| 53 static bool SkStrContains(const char string[], const char subchar) { | 53 static bool SkStrContains(const char string[], const char subchar) { |
| 54 SkASSERT(string); | 54 SkASSERT(string); |
| 55 char tmp[2]; | 55 char tmp[2]; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 }; | 281 }; |
| 282 | 282 |
| 283 // Split str on any characters in delimiters into out. (Think, strtok with a sa
ne API.) | 283 // Split str on any characters in delimiters into out. (Think, strtok with a sa
ne API.) |
| 284 void SkStrSplit(const char* str, const char* delimiters, SkStrSplitMode splitMod
e, | 284 void SkStrSplit(const char* str, const char* delimiters, SkStrSplitMode splitMod
e, |
| 285 SkTArray<SkString>* out); | 285 SkTArray<SkString>* out); |
| 286 inline void SkStrSplit(const char* str, const char* delimiters, SkTArray<SkStrin
g>* out) { | 286 inline void SkStrSplit(const char* str, const char* delimiters, SkTArray<SkStrin
g>* out) { |
| 287 SkStrSplit(str, delimiters, kCoalesce_SkStrSplitMode, out); | 287 SkStrSplit(str, delimiters, kCoalesce_SkStrSplitMode, out); |
| 288 } | 288 } |
| 289 | 289 |
| 290 #endif | 290 #endif |
| OLD | NEW |