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 #include "SkString.h" | 10 #include "SkString.h" |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 /////////////////////////////////////////////////////////////////////////////// | 627 /////////////////////////////////////////////////////////////////////////////// |
628 | 628 |
629 SkString SkStringPrintf(const char* format, ...) { | 629 SkString SkStringPrintf(const char* format, ...) { |
630 SkString formattedOutput; | 630 SkString formattedOutput; |
631 char buffer[kBufferSize]; | 631 char buffer[kBufferSize]; |
632 ARGS_TO_BUFFER(format, buffer, kBufferSize); | 632 ARGS_TO_BUFFER(format, buffer, kBufferSize); |
633 formattedOutput.set(buffer); | 633 formattedOutput.set(buffer); |
634 return formattedOutput; | 634 return formattedOutput; |
635 } | 635 } |
636 | 636 |
| 637 void SkStrSplit(const char* str, const char* delimiters, SkTArray<SkString>* out
) { |
| 638 const char* end = str + strlen(str); |
| 639 while (str != end) { |
| 640 // Find a token. |
| 641 const size_t len = strcspn(str, delimiters); |
| 642 out->push_back().set(str, len); |
| 643 str += len; |
| 644 // Skip any delimiters. |
| 645 str += strspn(str, delimiters); |
| 646 } |
| 647 } |
| 648 |
637 #undef VSNPRINTF | 649 #undef VSNPRINTF |
638 #undef SNPRINTF | 650 #undef SNPRINTF |
OLD | NEW |