Ignition Common

API Reference

4.4.0
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 
45  std::string IGNITION_COMMON_VISIBLE Join(
46  const std::vector<std::string> &_orig, const std::string &_delim);
47 
57  std::string IGNITION_COMMON_VISIBLE Join(
58  const std::vector<std::string> &_orig, char _delim);
59 
64  bool IGNITION_COMMON_VISIBLE StartsWith(const std::string &_s1,
65  const std::string &_s2);
66 
71  bool IGNITION_COMMON_VISIBLE EndsWith(const std::string &_s1,
72  const std::string &_s2);
73 
81  std::string IGNITION_COMMON_VISIBLE PluralCast(
82  const std::string &_baseWord, const int _n);
83 
90  std::string IGNITION_COMMON_VISIBLE PluralCast(
91  const std::string &_singular,
92  const std::string &_plural,
93  const int _n);
94  }
95 }
96 
97 #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...
std::string Join(const std::vector< std::string > &_orig, const std::string &_delim)
Join a sequence of strings with a delimiter.
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