| OpenCV 3.4.8 Open Source Computer Vision

Public Types | Public Member Functions | Static Public Attributes | Friends | List of all members
cv::String Class Reference
Core functionality » Basic structures

`#include <opencv2/core/cvstd.hpp>`

## Public Types
typedef const char * | const_iterator
typedef const char * | const_pointer
typedef const char & | const_reference
typedef ptrdiff_t | difference_type
typedef char * | iterator
typedef char * | pointer
typedef char & | reference
typedef size_t | size_type
typedef char | value_type

## Public Member Functions
| String ()
| String (const String &str)
| String (const String &str, size_t pos, size_t len=npos)
| String (const char *s)
| String (const char *s, size_t n)
| String (size_t n, char c)
| String (const char *first, const char *last)
template<typename Iterator >
| String (Iterator first, Iterator last)
| String (const FileNode &fn)
| String (const std::string &str)
| String (const std::string &str, size_t pos, size_t len=npos)
| ~String ()
const char * | begin () const
const char * | c_str () const
void | clear ()
int | compare (const char *s) const
int | compare (const String &str) const
bool | empty () const
const char * | end () const
size_t | find (const char *s, size_t pos, size_t n) const
size_t | find (char c, size_t pos=0) const
size_t | find (const String &str, size_t pos=0) const
size_t | find (const char *s, size_t pos=0) const
size_t | find_first_of (const char *s, size_t pos, size_t n) const
size_t | find_first_of (char c, size_t pos=0) const
size_t | find_first_of (const String &str, size_t pos=0) const
size_t | find_first_of (const char *s, size_t pos=0) const
size_t | find_last_of (const char *s, size_t pos, size_t n) const
size_t | find_last_of (char c, size_t pos=npos) const
size_t | find_last_of (const String &str, size_t pos=npos) const
size_t | find_last_of (const char *s, size_t pos=npos) const
size_t | length () const
| operator std::string () const
String & | operator+= (const String &str)
String & | operator+= (const char *s)
String & | operator+= (char c)
String & | operator+= (const std::string &str)
String & | operator= (const String &str)
String & | operator= (const char *s)
String & | operator= (char c)
String & | operator= (const std::string &str)
char | operator[] (size_t idx) const
char | operator[] (int idx) const
size_t | rfind (const char *s, size_t pos, size_t n) const
size_t | rfind (char c, size_t pos=npos) const
size_t | rfind (const String &str, size_t pos=npos) const
size_t | rfind (const char *s, size_t pos=npos) const
size_t | size () const
String | substr (size_t pos=0, size_t len=npos) const
void | swap (String &str)
String | toLowerCase () const

## Static Public Attributes
static const size_t | npos = size_t(-1)

## Friends
String | operator+ (const String &lhs, const String &rhs)
String | operator+ (const String &lhs, const char *rhs)
String | operator+ (const char *lhs, const String &rhs)
String | operator+ (const String &lhs, char rhs)
String | operator+ (char lhs, const String &rhs)
String | operator+ (const String &lhs, const std::string &rhs)
String | operator+ (const std::string &lhs, const String &rhs)

## Related Functions
(Note that these are not member functions.)
String | operator+ (const String &lhs, const String &rhs)
String | operator+ (const String &lhs, const char *rhs)
String | operator+ (const char *lhs, const String &rhs)
String | operator+ (const String &lhs, char rhs)
String | operator+ (char lhs, const String &rhs)
static bool | operator== (const String &lhs, const String &rhs)
static bool | operator== (const char *lhs, const String &rhs)
static bool | operator== (const String &lhs, const char *rhs)
static bool | operator!= (const String &lhs, const String &rhs)
static bool | operator!= (const char *lhs, const String &rhs)
static bool | operator!= (const String &lhs, const char *rhs)
static bool | operator< (const String &lhs, const String &rhs)
static bool | operator< (const char *lhs, const String &rhs)
static bool | operator< (const String &lhs, const char *rhs)
static bool | operator<= (const String &lhs, const String &rhs)
static bool | operator<= (const char *lhs, const String &rhs)
static bool | operator<= (const String &lhs, const char *rhs)
static bool | operator> (const String &lhs, const String &rhs)
static bool | operator> (const char *lhs, const String &rhs)
static bool | operator> (const String &lhs, const char *rhs)
static bool | operator>= (const String &lhs, const String &rhs)
static bool | operator>= (const char *lhs, const String &rhs)
static bool | operator>= (const String &lhs, const char *rhs)
static std::string | toLowerCase (const std::string &str)
static std::string | toUpperCase (const std::string &str)

## Detailed Description

Examples:
  samples/cpp/connected_components.cpp, samples/cpp/create_mask.cpp, samples/cpp/falsecolor.cpp, samples/cpp/stitching_detailed.cpp, samples/cpp/train_HOG.cpp, samples/cpp/tutorial_code/features2D/Homography/decompose_homography.cpp, samples/cpp/tutorial_code/features2D/Homography/homography_from_camera_displacement.cpp, samples/cpp/tutorial_code/features2D/Homography/pose_from_homography.cpp, samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp, samples/cpp/tutorial_code/ImgProc/Morphology_2.cpp, samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp, samples/cpp/tutorial_code/ml/introduction_to_pca/introduction_to_pca.cpp, samples/cpp/tutorial_code/photo/non_photorealistic_rendering/npr_demo.cpp, samples/cpp/warpPerspective_demo.cpp, samples/dnn/classification.cpp, samples/dnn/object_detection.cpp, samples/dnn/openpose.cpp, samples/dnn/segmentation.cpp, and samples/dnn/text_detection.cpp.

## Member Typedef Documentation

## § const_iterator

typedef const char* cv::String::const_iterator

## § const_pointer

typedef const char* cv::String::const_pointer

## § const_reference

typedef const char& cv::String::const_reference

## § difference_type

typedef ptrdiff_t cv::String::difference_type

## § iterator

typedef char* cv::String::iterator

## § pointer

typedef char* cv::String::pointer

## § reference

typedef char& cv::String::reference

## § size_type

typedef size_t cv::String::size_type

## § value_type

typedef char cv::String::value_type

## Constructor & Destructor Documentation

## § String() [1/11]

cv::String::String | ( |  | ) |

## § String() [2/11]

cv::String::String | ( | const String & | str | ) |

## § String() [3/11]

cv::String::String | ( | const String & | str,
|  | size_t | pos,
|  | size_t | len = `npos`
| ) |  |

## § String() [4/11]

cv::String::String | ( | const char * | s | ) |

## § String() [5/11]

cv::String::String | ( | const char * | s,
|  | size_t | n
| ) |  |

## § String() [6/11]

cv::String::String | ( | size_t | n,
|  | char | c
| ) |  |

## § String() [7/11]

cv::String::String | ( | const char * | first,
|  | const char * | last
| ) |  |

## § String() [8/11]

template<typename Iterator >

cv::String::String | ( | Iterator | first,
|  | Iterator | last
| ) |  |

## § String() [9/11]

cv::String::String | ( | const FileNode & | fn | ) |
| explicit

## § ~String()

cv::String::~String | ( |  | ) |

## § String() [10/11]

cv::String::String | ( | const std::string & | str | ) |

## § String() [11/11]

cv::String::String | ( | const std::string & | str,
|  | size_t | pos,
|  | size_t | len = `npos`
| ) |  |

## Member Function Documentation

## § begin()

const char* cv::String::begin | ( |  | ) | const

## § c_str()

const char* cv::String::c_str | ( |  | ) | const

Examples:
  samples/cpp/create_mask.cpp, and samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp.

## § clear()

void cv::String::clear | ( |  | ) |

## § compare() [1/2]

int cv::String::compare | ( | const char * | s | ) | const

Examples:
  samples/dnn/openpose.cpp.

## § compare() [2/2]

int cv::String::compare | ( | const String & | str | ) | const

## § empty()

bool cv::String::empty | ( |  | ) | const

Examples:
  samples/cpp/create_mask.cpp, samples/cpp/train_HOG.cpp, samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp, and samples/dnn/openpose.cpp.

## § end()

const char* cv::String::end | ( |  | ) | const

## § find() [1/4]

size_t cv::String::find | ( | const char * | s,
|  | size_t | pos,
|  | size_t | n
| ) |  | const

## § find() [2/4]

size_t cv::String::find | ( | char | c,
|  | size_t | pos = `0`
| ) |  | const

## § find() [3/4]

size_t cv::String::find | ( | const String & | str,
|  | size_t | pos = `0`
| ) |  | const

## § find() [4/4]

size_t cv::String::find | ( | const char * | s,
|  | size_t | pos = `0`
| ) |  | const

## § find_first_of() [1/4]

size_t cv::String::find_first_of | ( | const char * | s,
|  | size_t | pos,
|  | size_t | n
| ) |  | const

## § find_first_of() [2/4]

size_t cv::String::find_first_of | ( | char | c,
|  | size_t | pos = `0`
| ) |  | const

## § find_first_of() [3/4]

size_t cv::String::find_first_of | ( | const String & | str,
|  | size_t | pos = `0`
| ) |  | const

## § find_first_of() [4/4]

size_t cv::String::find_first_of | ( | const char * | s,
|  | size_t | pos = `0`
| ) |  | const

## § find_last_of() [1/4]

size_t cv::String::find_last_of | ( | const char * | s,
|  | size_t | pos,
|  | size_t | n
| ) |  | const

Examples:
  samples/cpp/stitching_detailed.cpp.

## § find_last_of() [2/4]

size_t cv::String::find_last_of | ( | char | c,
|  | size_t | pos = `npos`
| ) |  | const

## § find_last_of() [3/4]

size_t cv::String::find_last_of | ( | const String & | str,
|  | size_t | pos = `npos`
| ) |  | const

## § find_last_of() [4/4]

size_t cv::String::find_last_of | ( | const char * | s,
|  | size_t | pos = `npos`
| ) |  | const

## § length()

size_t cv::String::length | ( |  | ) | const

## § operator std::string()

cv::String::operator std::string | ( |  | ) | const

## § operator+=() [1/4]

String& cv::String::operator+= | ( | const String & | str | ) |

## § operator+=() [2/4]

String& cv::String::operator+= | ( | const char * | s | ) |

## § operator+=() [3/4]

String& cv::String::operator+= | ( | char | c | ) |

## § operator+=() [4/4]

String& cv::String::operator+= | ( | const std::string & | str | ) |

## § operator=() [1/4]

String& cv::String::operator= | ( | const String & | str | ) |

## § operator=() [2/4]

String& cv::String::operator= | ( | const char * | s | ) |

## § operator=() [3/4]

String& cv::String::operator= | ( | char | c | ) |

## § operator=() [4/4]

String& cv::String::operator= | ( | const std::string & | str | ) |

## § operator[]() [1/2]

char cv::String::operator[] | ( | size_t | idx | ) | const

## § operator[]() [2/2]

char cv::String::operator[] | ( | int | idx | ) | const

## § rfind() [1/4]

size_t cv::String::rfind | ( | const char * | s,
|  | size_t | pos,
|  | size_t | n
| ) |  | const

## § rfind() [2/4]

size_t cv::String::rfind | ( | char | c,
|  | size_t | pos = `npos`
| ) |  | const

## § rfind() [3/4]

size_t cv::String::rfind | ( | const String & | str,
|  | size_t | pos = `npos`
| ) |  | const

## § rfind() [4/4]

size_t cv::String::rfind | ( | const char * | s,
|  | size_t | pos = `npos`
| ) |  | const

## § size()

size_t cv::String::size | ( |  | ) | const

Examples:
  samples/cpp/train_HOG.cpp.

## § substr()

String cv::String::substr | ( | size_t | pos = `0`,
|  | size_t | len = `npos`
| ) |  | const

Examples:
  samples/cpp/stitching_detailed.cpp.

## § swap()

void cv::String::swap | ( | String & | str | ) |

## § toLowerCase()

String cv::String::toLowerCase | ( |  | ) | const

## Friends And Related Function Documentation

## § operator!=() [1/3]

static bool operator!= | ( | const String & | lhs,
|  | const String & | rhs
| ) |  |
| related

## § operator!=() [2/3]

static bool operator!= | ( | const char * | lhs,
|  | const String & | rhs
| ) |  |
| related

## § operator!=() [3/3]

static bool operator!= | ( | const String & | lhs,
|  | const char * | rhs
| ) |  |
| related

## § operator+ [1/12]

String operator+ | ( | const String & | lhs,
|  | const String & | rhs
| ) |  |
| friend

## § operator+ [2/12]

String operator+ | ( | const String & | lhs,
|  | const char * | rhs
| ) |  |
| friend

## § operator+ [3/12]

String operator+ | ( | const char * | lhs,
|  | const String & | rhs
| ) |  |
| friend

## § operator+ [4/12]

String operator+ | ( | const String & | lhs,
|  | char | rhs
| ) |  |
| friend

## § operator+ [5/12]

String operator+ | ( | char | lhs,
|  | const String & | rhs
| ) |  |
| friend

## § operator+ [6/12]

String operator+ | ( | const String & | lhs,
|  | const std::string & | rhs
| ) |  |
| friend

## § operator+ [7/12]

String operator+ | ( | const std::string & | lhs,
|  | const String & | rhs
| ) |  |
| friend

## § operator+() [8/12]

String operator+ | ( | const String & | lhs,
|  | const String & | rhs
| ) |  |
| related

## § operator+() [9/12]

String operator+ | ( | const String & | lhs,
|  | const char * | rhs
| ) |  |
| related

## § operator+() [10/12]

String operator+ | ( | const char * | lhs,
|  | const String & | rhs
| ) |  |
| related

## § operator+() [11/12]

String operator+ | ( | const String & | lhs,
|  | char | rhs
| ) |  |
| related

## § operator+() [12/12]

String operator+ | ( | char | lhs,
|  | const String & | rhs
| ) |  |
| related

## § operator<() [1/3]

static bool operator< | ( | const String & | lhs,
|  | const String & | rhs
| ) |  |
| related

## § operator<() [2/3]

static bool operator< | ( | const char * | lhs,
|  | const String & | rhs
| ) |  |
| related

## § operator<() [3/3]

static bool operator< | ( | const String & | lhs,
|  | const char * | rhs
| ) |  |
| related

## § operator<=() [1/3]

static bool operator<= | ( | const String & | lhs,
|  | const String & | rhs
| ) |  |
| related

## § operator<=() [2/3]

static bool operator<= | ( | const char * | lhs,
|  | const String & | rhs
| ) |  |
| related

## § operator<=() [3/3]

static bool operator<= | ( | const String & | lhs,
|  | const char * | rhs
| ) |  |
| related

## § operator==() [1/3]

static bool operator== | ( | const String & | lhs,
|  | const String & | rhs
| ) |  |
| related

## § operator==() [2/3]

static bool operator== | ( | const char * | lhs,
|  | const String & | rhs
| ) |  |
| related

## § operator==() [3/3]

static bool operator== | ( | const String & | lhs,
|  | const char * | rhs
| ) |  |
| related

## § operator>() [1/3]

static bool operator> | ( | const String & | lhs,
|  | const String & | rhs
| ) |  |
| related

## § operator>() [2/3]

static bool operator> | ( | const char * | lhs,
|  | const String & | rhs
| ) |  |
| related

## § operator>() [3/3]

static bool operator> | ( | const String & | lhs,
|  | const char * | rhs
| ) |  |
| related

## § operator>=() [1/3]

static bool operator>= | ( | const String & | lhs,
|  | const String & | rhs
| ) |  |
| related

## § operator>=() [2/3]

static bool operator>= | ( | const char * | lhs,
|  | const String & | rhs
| ) |  |
| related

## § operator>=() [3/3]

static bool operator>= | ( | const String & | lhs,
|  | const char * | rhs
| ) |  |
| related

## § toLowerCase()

static std::string toLowerCase | ( | const std::string & | str | ) |
| related

## § toUpperCase()

static std::string toUpperCase | ( | const std::string & | str | ) |
| related

## Member Data Documentation

## § npos

const size_t cv::String::npos = size_t(-1)
| static

The documentation for this class was generated from the following file:

- opencv2/core/cvstd.hpp