Strings Library
- <cctype> Functions
- std::chars_format
- std::to_chars - convert a number to different forms depending on the given format and writes it to a character array.
- std::from_chars - coverts characters to numbers.
- Strings
- std::size_t - unsigned integer type representing size.
- std::strcpy - copy a character array to another character array.
- std::strncpy - copy the first n characters of a character array.
- std::strcat - concatination of two character arrays.
- std::strncat - concatinate n characters of a character array to the end of another character array.
- std::strxfrm - replace the first n characters of a character array with the first n characters of another character array.
- std::strlen - the length of a character array.
- std::strcmp - compares two character arrays alphabetically.
- std::strncmp - compares first n characters of two character arrays alphabetically.
- std::strcoll - compares two character arrays according to the current locale.
- std::strchr - finds the first occurrance of a character in a character array.
- std::strrchr - finds the last occurrance of a character.
- std::strspn - returns the length of the substring starting from the beginning to contain only the characters present in the second character string.
- std::strcspn - returns the length of the substring starting from the beginning to contain only the characters absent from the second character string.
- std::strpbrk - looks for any character from one character array in another character array.
- std::strstr - searchs for a character array in another character array.
- std::strtok - finds next token in character array.
- std::memchr - search for character in void*.
- std::memcmp - compares count number of characters in two void*.
- std::memset - copies int into the first count characters pointed to by void*
- std::memcpy - copies count bytes from one void* object to another void* object
- std::memmove - copies count characters from one void* object to another void* object
- Multibyte Characters
- Wide and Multibyte Strings
- Null-terminated Multibyte Strings
- std::mbstowcs - converts a string to wide string
- std::mbtowc - convert the next character to a wide character
- std::wcstombs - converts a wide string to a string
- std::wctomb - converts a wide character to a char
- String Manipulation
- std::wcscpy - copies const wchar_t* to another wchar_t*
- std::wcsncpy - copies at most count characters from const wchar_t* to wchar_t*.
- std::wcscat - appends whatever const wchar_t* points to to the end of whatever wchar_t*
points to.
- std::wcsncat - appends at most count characters from whatever const wchar_t* points to to the end of whatever wchar_t* points to.
- std::wcsxfrm - copies count characters from const wchar_t* to wchar_t*
- String Examination
- std::wcslen - returns length of a const wchar_t*
- std::wcscmp - compares two const wchar_t* alphabetically
- std::wcsncmp - compares count characters of two const wchar_t* alphabetically
- std::wcscoll - compares two const wchar_t* based on the current locale
- std::wcschr - find the first occurrence of a wchar_t in a const wchar_t*
- std::wcsrchr - find the last occurrence of a wchar_t in a const wchar_t*
- std::wcsspn - returns the length of a segment of a const wchar_t* consisting only of characters appearing in a const wchar_t*
- std::wcscspn - returns the length of a segment of a const wchar_t* consisting only of characters not appearing in a const wchar_t*
- std::wcspbrk - finds first character appearing in const wchar_t* that also appears in const wchar_t*
- std::wcsstr - find first occurrence of const wchar_t* found in const wchar_t*
- std::wcstok - finds next token in a wchar_t*.
- Wide Character Array Manipulation
- std::wmemcpy - copies count wide characters from one wide character array to another.
- std::wmemmove - copies count wide characters from one wide character array to another.
- std::wmemcmp - compares the first count wide characters of two wide character arrays.
- std::wmemchr - finds the first occurrence of wide character in the initial count wide characters of the wide character array
- std::wmemset - copies a wide character into the first count wide characters of a wide character array.
- Multibyte/Wide Character Conversion
- std::mbsinit - checks for the initial conversion state.
- std::btowc - converts a character to a wide character.
- std::wctob - converts a wide character to a character.
- std::mbrlen -
- std::mbrtowc - converts a narrow multibyte character to a wide character
- std::wcrtomb - converts a wide character to its narrow multibyte representation.
- std::mbsrtowcs - converts a null-terminated multibyte character sequence to a wide character
- std::wcsrtombs - converts a wide character sequence to a multibyte character
- Input/Output
- std::fgetwc, std::getwc - reads the next wide character from a stream.
- std::fgetws - reads up to count - 1 wide characters from a stream.
- std::fputwc, std::putwc - writes a wide character to a stream.
- std::fputws - writes wide characters from a wide string to a stream.
- std::getwchar - reads the next wide character from stdin.
- std::putwchar - writes a wide character ch to stdout.
- std::ungetwc - writes a wide character to an input buffer associated with a stream so that the next read from the stream will read that character.
- std::fwide - attempts to make stream wide oriented or byte oriented depending on the value of mode.
- std::wscanf, std::fwscanf, std::swscanf - reads from different sources.
- std::wprintf, std::fwprintf, std::swprintf - reads data, makes it wide, then writes it somewhere.
- std::vwprintf, std::vfwprintf, std::vswprintf - reads data, makes it wide, then writes it somewhere.
- String Conversions
- std::wcsftime - converts the date and time to a null-terminated wide character string.
- std::wcstol, std::wcstoll - gets an integer from a wide string.
- std::wcstoul, std::wcstoull - gets an unsigned integer from a wide string.
- std::wcstof, std::wcstod, std::wcstold - gets an floating point value from a wide string.
- null-terminated wide strings
- Character Classification
- std::iswalnum - checks if the given wide character is alphanumeric.
- std::iswalpha - checks if the given wide character is alphabetic.
- std::iswlower - checks the case of a wide character for lower.
- std::iswupper - checks the case of a wide character for upper.
- std::iswdigit - checkes if a wide character is any of 0123456789.
- std::iswxdigit - checkes if a wide character is a hexidecimal number.
- std::iswcntrl - checks if a character is a control character.
- std::iswgraph - checks if a wide character has a graphical representation.
- std::iswspace - checks if the given wide character is a wide whitespace character.
- std::iswblank - checks if the given wide character is classified as blank character (generally tabs and spaces)
- std::iswprint - checks if the given wide character can be printed.
- std::iswpunct - checks if the given wide character is a punctuation character.
- std::iswctype, std::wctype - creates a value of type std::wctype_t.
- Character Manipulation
- basic_string
- Constructor - creates a new string.
- operator= - value assignment operator.
- basic_string::assign - assigns value to string
- basic_string::get_allocator
- Element access
- basic_string::at - returns referenc to character at given index.
- basic_string::operator[] - returns referenc to character at given index.
- basic_string::front - returns reference to first character in a string.
- basic_string::back - returns reference to last character in a string.
- basic_string::data - returns a pointer to the array storing the string.
- basic_string::c_str - returns a pointer to the array storing the string.
- std::operator basic_string_view - returns a string view of the string.
- Iterators
- basic_string::begin, basic_string::end - returns an iterator to the first character of a string (begin), or the last character of a string (end)
- basic_string::cbegin, basic_string::cend - returns a constant iterator to the first character of a string (cbegin), or the last character of a string (cend)
- basic_string::rbegin, basic_string::rend - returns a reverse iterator to the first character of a string (rbegin), or the last character of a string (rend)
- basic_string::crbegin, basic_string::crend - returns a constant reverse iterator to the first character of a string (crbegin), or the last character of a string (crend)
- Capacity
- basic_string::empty - returns true if the string is empty.
- basic_string::size, basic_string::length - returns the number of characters in a string.
- basic_string::max_size - returns the maximum number of characters a string is able to hold due to system limitations.
- basic_string::reserve, basic_string::capacity - allows string to prepare for a change in capacity (reserve).
- basic_string::shrink_to_fit - removes unused capacity.
- Modifiers
- basic_string::clear - removes all the characters from a string.
- basic_string::insert - iserts a character into a string.
- basic_string::erase - removes characters from a string.
- basic_string::push_back - adds a character to the end of a string.
- basic_string::pop_back - removes a character from the end of a string.
- basic_string::append - adds characters to the end of a string.
- basic_string::operator+= - adds characters to the end of a string.
- basic_string::replace - replaces characters within a range in a string.
- basic_string::copy - copies characters.
- basic_string::resize - resizes a string to count characters.
- basic_string::swap - exchanges contents of two strings.
- Search
- basic_string::find - search a string.
- basic_string::rfind - search a string from last to first.
- basic_string::find_first_of - finds the first character appearing in two strings.
- basic_string::find_first_not_of - first first character in a string that isn't present in another string.
- basic_string::find_last_of - finds the last character to be present in another string.
- basic_string::find_last_not_of - finds the last character not to be present in another string.
- Operations
- basic_string::compare - compares two strings.
- basic_string::substr - returns a substring.
- Non-member functions
- concatenation operator(+) - adds string to the end of another string.
- Numeric conversions
- std::stoi, std::stol, std::stoll - converts string to number.
- std::stoul, std::stoull - converts string to number.
- std::stof, std::stod, std::stold - converts string to number.
- std::to_string - converts a number to string.
- std::to_wstring - converts a number to wide character string.
- std::operator""s - creates a string object from string literal. You'll need to refer to the example to really understand what this is doing.
- basic_string_view
C++ Examples© 2024 TBD