Gazebo Common

API Reference

4.7.0
gz/common/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 <gz/common/config.hh>
24 #include <gz/common/Export.hh>
25 
26 namespace ignition
27 {
28  namespace common
29  {
34  std::vector<std::string> IGNITION_COMMON_VISIBLE Split(
35  const std::string &_orig, char _delim);
36 
46  std::string IGNITION_COMMON_VISIBLE Join(
47  const std::vector<std::string> &_orig, const std::string &_delim);
48 
58  std::string IGNITION_COMMON_VISIBLE Join(
59  const std::vector<std::string> &_orig, char _delim);
60 
65  bool IGNITION_COMMON_VISIBLE StartsWith(const std::string &_s1,
66  const std::string &_s2);
67 
72  bool IGNITION_COMMON_VISIBLE EndsWith(const std::string &_s1,
73  const std::string &_s2);
74 
82  std::string IGNITION_COMMON_VISIBLE PluralCast(
83  const std::string &_baseWord, const int _n);
84 
91  std::string IGNITION_COMMON_VISIBLE PluralCast(
92  const std::string &_singular,
93  const std::string &_plural,
94  const int _n);
95  }
96 }
97 
98 #endif
Forward declarations for the common classes.
STL class.
STL class.
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
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.