Home | History | Annotate | Download | only in include
      1 /*
      2  * Copyright (C) 2012 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
      5  * use this file except in compliance with the License. You may obtain a copy of
      6  * the License at
      7  *
      8  * http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
     12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
     13  * License for the specific language governing permissions and limitations under
     14  * the License.
     15  */
     16 
     17 
     18 #ifndef CTSAUDIO_STRINGUTIL_H
     19 #define CTSAUDIO_STRINGUTIL_H
     20 
     21 #include <utils/String8.h>
     22 #include <vector>
     23 
     24 /**
     25  * Utility class for implementing missing features from android::String8
     26  */
     27 class StringUtil {
     28 public:
     29     /// split the given string with given delimiter and return the vector of string
     30     /// it may return NULL if memory alloc fails.
     31     /// If vector is not NULL, there will be at least one string
     32     static std::vector<android::String8>* split(const android::String8& str, char delimiter);
     33     /// This function will return zero length string if pos is invalid.
     34     static android::String8 substr(const android::String8& str, size_t pos, size_t n);
     35     static int compare(const android::String8& str, const char* other);
     36     static bool endsWith(const android::String8& str, const char* other);
     37 };
     38 
     39 
     40 #endif // CTSAUDIO_STRINGUTIL_H
     41