Ignition Common

API Reference

3.6.1
StringUtils.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of 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,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 #ifndef IGNITION_COMMON_STRINGUTILS_HH_
18 #define IGNITION_COMMON_STRINGUTILS_HH_
19 
20 #include <string>
21 #include <vector>
22 
23 #include <ignition/common/Export.hh>
24 
25 namespace ignition
26 {
27  namespace common
28  {
33  std::vector<std::string> IGNITION_COMMON_VISIBLE Split(
34  const std::string &_orig, char _delim);
35 
40  bool IGNITION_COMMON_VISIBLE StartsWith(const std::string &_s1,
41  const std::string &_s2);
42 
47  bool IGNITION_COMMON_VISIBLE EndsWith(const std::string &_s1,
48  const std::string &_s2);
49 
57  std::string IGNITION_COMMON_VISIBLE PluralCast(
58  const std::string &_baseWord, const int _n);
59 
66  std::string IGNITION_COMMON_VISIBLE PluralCast(
67  const std::string &_singular,
68  const std::string &_plural,
69  const int _n);
70  }
71 }
72 
73 #endif
bool EndsWith(const std::string &_s1, const std::string &_s2)
return true if string ends with another string
std::string PluralCast(const std::string &_baseWord, const int _n)
Choose whether to use a singular or plural version of a noun based on the value of an integer quantit...
STL class.
STL class.
Forward declarations for the common classes.
std::vector< std::string > Split(const std::string &_orig, char _delim)
split at a one character delimiter to get a vector of something
bool StartsWith(const std::string &_s1, const std::string &_s2)
return true if string starts with another string