cpp-strings 1.0.4
Pythonic c++ strings
Loading...
Searching...
No Matches
pcs Namespace Reference

Classes

class  CppStringT
 This is the templated base class for all CppString classes. More...
class  Slice
 Base class for slices, with start, stop and step specified values. More...
struct  StartSlice
 Base class for slices, with start, stop and step specified values. More...
struct  StartStepSlice
 struct of slices with default step values More...
struct  StartStopSlice
 struct of slices with default start and stop values More...
struct  StepSlice
 struct of slices with default start and step values More...
struct  StopSlice
 struct of slices with default stop and step values More...
struct  StopStepSlice
 struct of slices with default stop values More...

Typedefs

using CppString = CppStringT<char>
 Specialization of basic class with template argument 'char'.
using CppWString = CppStringT<wchar_t>
 Specialization of basic class with template argument 'wchar_t'.

Functions

template<class CharT>
const bool is_alpha (const CharT ch) noexcept
 struct of slices with default start values
template<>
const bool is_alpha< char > (const char ch) noexcept
 Returns true if character ch is alphabetic, or false otherwise. Conforms to the current locale settings.
template<>
const bool is_alpha< wchar_t > (const wchar_t ch) noexcept
 Returns true if character ch is alphabetic, or false otherwise. Conforms to the current locale settings.
template<class CharT>
const bool is_ascii (const CharT ch) noexcept
 Returns true if character ch gets ASCII code, or false otherwise.
template<class CharT>
const bool is_decimal (const CharT ch) noexcept
 Returns true if character is a decimal digit, or false otherwise.
template<>
const bool is_decimal< char > (const char ch) noexcept
 Returns true if character is a decimal digit, or false otherwise.
template<>
const bool is_decimal< wchar_t > (const wchar_t ch) noexcept
 Returns true if character is a decimal digit, or false otherwise.
template<class CharT>
const bool is_digit (const CharT ch) noexcept
 Returns true if character is a decimal digit, or false otherwise.
template<>
const bool is_digit< char > (const char ch) noexcept
 Returns true if character is a decimal digit, or false otherwise.
template<>
const bool is_digit< wchar_t > (const wchar_t ch) noexcept
 Returns true if character is a decimal digit, or false otherwise.
template<class CharT>
const bool is_id_continue (const CharT ch) noexcept
 Returns true if character is a continuing char for identifiers, or false otherwise.
template<class CharT>
const bool is_id_start (const CharT ch) noexcept
 Returns true if character is a starting char for identifiers, or false otherwise.
template<class CharT>
const bool is_lower (const CharT ch) noexcept
 Returns true if character is lowercase, or false otherwise.
template<>
const bool is_lower< char > (const char ch) noexcept
 Returns true if character ch is lowercase, or false otherwise. Conforms to the current locale settings.
template<>
const bool is_lower< wchar_t > (const wchar_t ch) noexcept
 Returns true if character ch is lowercase, or false otherwise. Conforms to the current locale settings.
template<class CharT>
const bool is_numeric (const CharT ch) noexcept
 Returns true if character is a decimal digit, or false otherwise.
template<>
const bool is_numeric< char > (const char ch) noexcept
 Returns true if character is a decimal digit, or false otherwise.
template<>
const bool is_numeric< wchar_t > (const wchar_t ch) noexcept
 Returns true if character is a decimal digit, or false otherwise.
template<class CharT>
const bool is_printable (const CharT ch) noexcept
 Returns true if character ch is printable, or false otherwise.
template<>
const bool is_printable< char > (const char ch) noexcept
 Returns true if character ch is printable, or false otherwise.
template<>
const bool is_printable< wchar_t > (const wchar_t ch) noexcept
 Returns true if character ch is punctuation, or false otherwise. Conforms to the current locale settings.
template<class CharT>
const bool is_punctuation (const CharT ch) noexcept
 Returns true if character ch is punctuation, or false otherwise.
template<>
const bool is_punctuation< char > (const char ch) noexcept
 Returns true if character ch is punctuation, or false otherwise. Conforms to the current locale settings.
template<>
const bool is_punctuation< wchar_t > (const wchar_t ch) noexcept
 Returns true if character ch is punctuation, or false otherwise. Conforms to the current locale settings.
template<class CharT>
const bool is_space (const CharT ch) noexcept
 Returns true if character ch is white space, or false otherwise.
template<>
const bool is_space< char > (const char ch) noexcept
 Returns true if character ch is alphabetic, or false otherwise. Conforms to the current locale settings.
template<>
const bool is_space< wchar_t > (const wchar_t ch) noexcept
 Returns true if character ch is alphabetic, or false otherwise. Conforms to the current locale settings.
template<class CharT>
const bool is_upper (const CharT ch) noexcept
 Returns true if character is uppercase, or false otherwise.
template<>
const bool is_upper< char > (const char ch) noexcept
 Returns true if character ch is uppercase, or false otherwise. Conforms to the current locale settings.
template<>
const bool is_upper< wchar_t > (const wchar_t ch) noexcept
 Returns true if character ch is uppercase, or false otherwise. Conforms to the current locale settings.
CppString operator""_cs (const char *str, std::size_t len)
 Forms a CppString literal.
CppWString operator""_cs (const wchar_t *str, std::size_t len)
 Forms a CppWString literal.
template<class CharT>
const CharT swap_case (const CharT ch) noexcept
 Returns the swapped case form of character ch if it exists, or ch itself otherwise.
template<class CharT>
const CharT to_lower (const CharT ch) noexcept
 Returns the lowercase form of character ch if it exists, or ch itself otherwise.
template<>
const char to_lower< char > (const char ch) noexcept
 Returns the lowercase form of character ch if it exists, or ch itself otherwise. Conforms to the current locale settings.
template<>
const wchar_t to_lower< wchar_t > (const wchar_t ch) noexcept
 Returns the lowercase form of character ch if it exists, or ch itself otherwise. Conforms to the current locale settings.
template<class CharT>
const CharT to_upper (const CharT ch) noexcept
 Returns the uppercase form of character ch if it exists, or ch itself otherwise.
template<>
const char to_upper< char > (const char ch) noexcept
 Returns the uppercase form of character ch if it exists, or ch itself otherwise. Conforms to the current locale settings.
template<>
const wchar_t to_upper< wchar_t > (const wchar_t ch) noexcept
 Returns the uppercase form of character ch if it exists, or ch itself otherwise. Conforms to the current locale settings.

Detailed Description

Library cppstrings "What if c++ strings where as easy to use as Python strings?"

Copyright (C) 2023-2026 Philippe Schmouker contact - ph (dot) schmouker (at) gmail (dot) com

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Typedef Documentation

◆ CppString

using pcs::CppString = CppStringT<char>

Specialization of basic class with template argument 'char'.

◆ CppWString

using pcs::CppWString = CppStringT<wchar_t>

Specialization of basic class with template argument 'wchar_t'.

Function Documentation

◆ is_alpha()

template<class CharT>
const bool pcs::is_alpha ( const CharT ch)
inlinenodiscardnoexcept

struct of slices with default start values

SHOULD NEVER BE USED. Use next specializations instead.

Returns true if character ch is alphabetic, or false otherwise.

References is_alpha().

Referenced by is_alpha(), is_id_start(), pcs::CppStringT< char >::isalnum(), and pcs::CppStringT< char >::isalpha().

◆ is_alpha< char >()

template<>
const bool pcs::is_alpha< char > ( const char ch)
inlinenodiscardnoexcept

Returns true if character ch is alphabetic, or false otherwise. Conforms to the current locale settings.

◆ is_alpha< wchar_t >()

template<>
const bool pcs::is_alpha< wchar_t > ( const wchar_t ch)
inlinenodiscardnoexcept

Returns true if character ch is alphabetic, or false otherwise. Conforms to the current locale settings.

◆ is_ascii()

template<class CharT>
const bool pcs::is_ascii ( const CharT ch)
inlinenodiscardnoexcept

Returns true if character ch gets ASCII code, or false otherwise.

Returns true if character has code point in the range U+0000-U+007F.

Referenced by pcs::CppStringT< char >::isascii().

◆ is_decimal()

template<class CharT>
const bool pcs::is_decimal ( const CharT ch)
inlinenodiscardnoexcept

Returns true if character is a decimal digit, or false otherwise.

SHOULD NEVER BE USED. Use next specializations instead.

Referenced by is_digit(), is_digit< char >(), is_digit< wchar_t >(), is_id_continue(), is_numeric(), is_numeric< char >(), is_numeric< wchar_t >(), pcs::CppStringT< char >::isalnum(), and pcs::CppStringT< char >::isdecimal().

◆ is_decimal< char >()

template<>
const bool pcs::is_decimal< char > ( const char ch)
inlinenodiscardnoexcept

Returns true if character is a decimal digit, or false otherwise.

◆ is_decimal< wchar_t >()

template<>
const bool pcs::is_decimal< wchar_t > ( const wchar_t ch)
inlinenodiscardnoexcept

Returns true if character is a decimal digit, or false otherwise.

◆ is_digit()

template<class CharT>
const bool pcs::is_digit ( const CharT ch)
inlinenodiscardnoexcept

Returns true if character is a decimal digit, or false otherwise.

SHOULD NEVER BE USED. Use next specializations instead.

References is_decimal().

Referenced by pcs::CppStringT< char >::isalnum().

◆ is_digit< char >()

template<>
const bool pcs::is_digit< char > ( const char ch)
inlinenodiscardnoexcept

Returns true if character is a decimal digit, or false otherwise.

References is_decimal().

◆ is_digit< wchar_t >()

template<>
const bool pcs::is_digit< wchar_t > ( const wchar_t ch)
inlinenodiscardnoexcept

Returns true if character is a decimal digit, or false otherwise.

References is_decimal().

◆ is_id_continue()

template<class CharT>
const bool pcs::is_id_continue ( const CharT ch)
inlinenodiscardnoexcept

Returns true if character is a continuing char for identifiers, or false otherwise.

References is_decimal(), and is_id_start().

Referenced by pcs::CppStringT< char >::isidentifier().

◆ is_id_start()

template<class CharT>
const bool pcs::is_id_start ( const CharT ch)
inlinenodiscardnoexcept

Returns true if character is a starting char for identifiers, or false otherwise.

References is_alpha().

Referenced by is_id_continue(), and pcs::CppStringT< char >::isidentifier().

◆ is_lower()

template<class CharT>
const bool pcs::is_lower ( const CharT ch)
inlinenodiscardnoexcept

Returns true if character is lowercase, or false otherwise.

SHOULD NEVER BE USED. Use next specializations instead.

Referenced by pcs::CppStringT< char >::islower(), and swap_case().

◆ is_lower< char >()

template<>
const bool pcs::is_lower< char > ( const char ch)
inlinenodiscardnoexcept

Returns true if character ch is lowercase, or false otherwise. Conforms to the current locale settings.

◆ is_lower< wchar_t >()

template<>
const bool pcs::is_lower< wchar_t > ( const wchar_t ch)
inlinenodiscardnoexcept

Returns true if character ch is lowercase, or false otherwise. Conforms to the current locale settings.

◆ is_numeric()

template<class CharT>
const bool pcs::is_numeric ( const CharT ch)
inlinenodiscardnoexcept

Returns true if character is a decimal digit, or false otherwise.

SHOULD NEVER BE USED. Use next specializations instead.

References is_decimal().

Referenced by pcs::CppStringT< char >::isalnum().

◆ is_numeric< char >()

template<>
const bool pcs::is_numeric< char > ( const char ch)
inlinenodiscardnoexcept

Returns true if character is a decimal digit, or false otherwise.

References is_decimal().

◆ is_numeric< wchar_t >()

template<>
const bool pcs::is_numeric< wchar_t > ( const wchar_t ch)
inlinenodiscardnoexcept

Returns true if character is a decimal digit, or false otherwise.

References is_decimal().

◆ is_printable()

template<class CharT>
const bool pcs::is_printable ( const CharT ch)
inlinenodiscardnoexcept

Returns true if character ch is printable, or false otherwise.

SHOULD NEVER BE USED. Use next specializations instead.

Referenced by pcs::CppStringT< char >::isprintable().

◆ is_printable< char >()

template<>
const bool pcs::is_printable< char > ( const char ch)
inlinenodiscardnoexcept

Returns true if character ch is printable, or false otherwise.

◆ is_printable< wchar_t >()

template<>
const bool pcs::is_printable< wchar_t > ( const wchar_t ch)
inlinenodiscardnoexcept

Returns true if character ch is punctuation, or false otherwise. Conforms to the current locale settings.

◆ is_punctuation()

template<class CharT>
const bool pcs::is_punctuation ( const CharT ch)
inlinenodiscardnoexcept

Returns true if character ch is punctuation, or false otherwise.

SHOULD NEVER BE USED. Use next specializations instead.

Referenced by pcs::CppStringT< char >::is_words_sep(), and pcs::CppStringT< char >::ispunctuation().

◆ is_punctuation< char >()

template<>
const bool pcs::is_punctuation< char > ( const char ch)
inlinenodiscardnoexcept

Returns true if character ch is punctuation, or false otherwise. Conforms to the current locale settings.

◆ is_punctuation< wchar_t >()

template<>
const bool pcs::is_punctuation< wchar_t > ( const wchar_t ch)
inlinenodiscardnoexcept

Returns true if character ch is punctuation, or false otherwise. Conforms to the current locale settings.

◆ is_space()

template<class CharT>
const bool pcs::is_space ( const CharT ch)
inlinenodiscardnoexcept

Returns true if character ch is white space, or false otherwise.

SHOULD NEVER BE USED. Use next specializations instead.

Referenced by pcs::CppStringT< char >::is_words_sep(), and pcs::CppStringT< char >::isspace().

◆ is_space< char >()

template<>
const bool pcs::is_space< char > ( const char ch)
inlinenodiscardnoexcept

Returns true if character ch is alphabetic, or false otherwise. Conforms to the current locale settings.

◆ is_space< wchar_t >()

template<>
const bool pcs::is_space< wchar_t > ( const wchar_t ch)
inlinenodiscardnoexcept

Returns true if character ch is alphabetic, or false otherwise. Conforms to the current locale settings.

◆ is_upper()

template<class CharT>
const bool pcs::is_upper ( const CharT ch)
inlinenodiscardnoexcept

Returns true if character is uppercase, or false otherwise.

SHOULD NEVER BE USED. Use next specializations instead.

Referenced by pcs::CppStringT< char >::isupper(), and swap_case().

◆ is_upper< char >()

template<>
const bool pcs::is_upper< char > ( const char ch)
inlinenodiscardnoexcept

Returns true if character ch is uppercase, or false otherwise. Conforms to the current locale settings.

◆ is_upper< wchar_t >()

template<>
const bool pcs::is_upper< wchar_t > ( const wchar_t ch)
inlinenodiscardnoexcept

Returns true if character ch is uppercase, or false otherwise. Conforms to the current locale settings.

◆ operator""_cs() [1/2]

CppString pcs::operator""_cs ( const char * str,
std::size_t len )
inline

Forms a CppString literal.

◆ operator""_cs() [2/2]

CppWString pcs::operator""_cs ( const wchar_t * str,
std::size_t len )
inline

Forms a CppWString literal.

◆ swap_case()

template<class CharT>
const CharT pcs::swap_case ( const CharT ch)
inlinenodiscardnoexcept

Returns the swapped case form of character ch if it exists, or ch itself otherwise.

References is_lower(), is_upper(), to_lower(), and to_upper().

Referenced by pcs::CppStringT< char >::swapcase().

◆ to_lower()

template<class CharT>
const CharT pcs::to_lower ( const CharT ch)
inlinenodiscardnoexcept

Returns the lowercase form of character ch if it exists, or ch itself otherwise.

SHOULD NEVER BE USED. Use next specializations instead.

Referenced by swap_case().

◆ to_lower< char >()

template<>
const char pcs::to_lower< char > ( const char ch)
inlinenodiscardnoexcept

Returns the lowercase form of character ch if it exists, or ch itself otherwise. Conforms to the current locale settings.

◆ to_lower< wchar_t >()

template<>
const wchar_t pcs::to_lower< wchar_t > ( const wchar_t ch)
inlinenodiscardnoexcept

Returns the lowercase form of character ch if it exists, or ch itself otherwise. Conforms to the current locale settings.

◆ to_upper()

template<class CharT>
const CharT pcs::to_upper ( const CharT ch)
inlinenodiscardnoexcept

Returns the uppercase form of character ch if it exists, or ch itself otherwise.

SHOULD NEVER BE USED. Use next specializations instead.

Referenced by pcs::CppStringT< char >::capitalize(), and swap_case().

◆ to_upper< char >()

template<>
const char pcs::to_upper< char > ( const char ch)
inlinenodiscardnoexcept

Returns the uppercase form of character ch if it exists, or ch itself otherwise. Conforms to the current locale settings.

◆ to_upper< wchar_t >()

template<>
const wchar_t pcs::to_upper< wchar_t > ( const wchar_t ch)
inlinenodiscardnoexcept

Returns the uppercase form of character ch if it exists, or ch itself otherwise. Conforms to the current locale settings.