OpenCV: cv::String Class Reference

| OpenCV 3.4.2 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 "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)

## Detailed Description

Examples:
  decompose_homography.cpp, falsecolor.cpp, homography_from_camera_displacement.cpp, lsd_lines.cpp, Morphology_1.cpp, npr_demo.cpp, pose_from_homography.cpp, Sobel_Demo.cpp, train_HOG.cpp, and warpPerspective_demo.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:
  Sobel_Demo.cpp.

## ◆ clear()

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

## ◆ compare() [1/2]

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

## ◆ compare() [2/2]

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

## ◆ empty()

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

Examples:
  Sobel_Demo.cpp, and train_HOG.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

## ◆ 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:
  train_HOG.cpp.

## ◆ substr()

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

## ◆ 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

## 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:

- core/include/opencv2/core/cvstd.hpp