56 [[nodiscard]]
inline constexpr bool hasExactLength( std::string_view str, std::size_t expectedLength )
noexcept;
64 [[nodiscard]]
inline constexpr bool isEmpty( std::string_view str )
noexcept;
82 [[nodiscard]]
inline constexpr bool isAllDigits( std::string_view str )
noexcept;
94 [[nodiscard]]
inline constexpr bool isWhitespace(
char c )
noexcept;
102 [[nodiscard]]
inline constexpr bool isDigit(
char c )
noexcept;
110 [[nodiscard]]
inline constexpr bool isAlpha(
char c )
noexcept;
126 [[nodiscard]]
inline constexpr bool isHexDigit(
char c )
noexcept;
139 [[nodiscard]]
inline constexpr bool startsWith( std::string_view str, std::string_view prefix )
noexcept;
148 [[nodiscard]]
inline constexpr bool endsWith( std::string_view str, std::string_view suffix )
noexcept;
157 [[nodiscard]]
inline constexpr bool contains( std::string_view str, std::string_view substr )
noexcept;
166 [[nodiscard]]
inline constexpr bool equals( std::string_view lhs, std::string_view rhs )
noexcept;
175 [[nodiscard]]
inline bool iequals( std::string_view lhs, std::string_view rhs )
noexcept;
185 [[nodiscard]]
inline std::size_t
count( std::string_view str, std::string_view substr )
noexcept;
196 [[nodiscard]]
inline std::size_t
countOverlapping( std::string_view str, std::string_view substr )
noexcept;
205 [[nodiscard]]
inline constexpr std::size_t
count( std::string_view str,
char ch )
noexcept;
216 [[nodiscard]]
inline std::string
replace( std::string_view str, std::string_view oldStr, std::string_view newStr );
227 [[nodiscard]]
inline std::string
replaceAll( std::string_view str, std::string_view oldStr, std::string_view newStr );
238 template <
typename Container>
239 [[nodiscard]]
inline std::string
join(
const Container& elements, std::string_view delimiter );
251 template <
typename Iterator>
252 [[nodiscard]]
inline std::string
join( Iterator begin, Iterator end, std::string_view delimiter );
262 [[nodiscard]]
inline std::string
reverse( std::string_view str );
273 [[nodiscard]]
inline constexpr std::size_t
indexOf( std::string_view str, std::string_view substr )
noexcept;
284 [[nodiscard]]
inline constexpr std::size_t
lastIndexOf( std::string_view str, std::string_view substr )
noexcept;
299 [[nodiscard]]
inline std::string
padLeft( std::string_view str, std::size_t width,
char fillChar =
' ' );
310 [[nodiscard]]
inline std::string
padRight( std::string_view str, std::size_t width,
char fillChar =
' ' );
322 [[nodiscard]]
inline std::string
center( std::string_view str, std::size_t width,
char fillChar =
' ' );
332 [[nodiscard]]
inline std::string
repeat( std::string_view str, std::size_t
count );
346 [[nodiscard]]
inline constexpr std::string_view
substringBefore( std::string_view str, std::string_view delimiter )
noexcept;
356 [[nodiscard]]
inline constexpr std::string_view
substringAfter( std::string_view str, std::string_view delimiter )
noexcept;
366 [[nodiscard]]
inline constexpr std::string_view
substringBeforeLast( std::string_view str, std::string_view delimiter )
noexcept;
376 [[nodiscard]]
inline constexpr std::string_view
substringAfterLast( std::string_view str, std::string_view delimiter )
noexcept;
388 [[nodiscard]]
inline constexpr std::string_view
extractBetween( std::string_view str, std::string_view start, std::string_view end )
noexcept;
398 [[nodiscard]]
inline constexpr std::string_view
removePrefix( std::string_view str, std::string_view prefix )
noexcept;
408 [[nodiscard]]
inline constexpr std::string_view
removeSuffix( std::string_view str, std::string_view suffix )
noexcept;
422 [[nodiscard]]
inline std::string
removeAll( std::string_view str,
char ch );
433 [[nodiscard]]
inline std::string
removeAll( std::string_view str, std::string_view substr );
444 template <
typename Predicate>
445 [[nodiscard]]
inline std::string
removeIf( std::string_view str, Predicate pred );
479 [[nodiscard]]
inline constexpr std::string_view
trimStart( std::string_view str )
noexcept;
488 [[nodiscard]]
inline constexpr std::string_view
trimEnd( std::string_view str )
noexcept;
497 [[nodiscard]]
inline constexpr std::string_view
trim( std::string_view str )
noexcept;
513 template <
typename Predicate>
514 [[nodiscard]]
inline constexpr std::string_view
trimStartIf( std::string_view str, Predicate pred )
noexcept;
526 template <
typename Predicate>
527 [[nodiscard]]
inline constexpr std::string_view
trimEndIf( std::string_view str, Predicate pred )
noexcept;
539 template <
typename Predicate>
540 [[nodiscard]]
inline constexpr std::string_view
trimIf( std::string_view str, Predicate pred )
noexcept;
551 template <
typename Predicate>
552 [[nodiscard]]
inline constexpr std::size_t
countIf( std::string_view str, Predicate pred )
noexcept;
563 template <
typename Predicate>
564 [[nodiscard]]
inline constexpr std::size_t
findIf( std::string_view str, Predicate pred )
noexcept;
575 template <
typename Predicate>
576 [[nodiscard]]
inline constexpr std::size_t
findIfNot( std::string_view str, Predicate pred )
noexcept;
589 template <
typename Predicate>
590 [[nodiscard]]
inline std::string
replaceIf( std::string_view str, Predicate pred,
char replacement );
604 [[nodiscard]]
inline std::string
toLower( std::string_view str );
614 [[nodiscard]]
inline std::string
toUpper( std::string_view str );
627 [[nodiscard]]
inline constexpr char toLower(
char c )
noexcept;
636 [[nodiscard]]
inline constexpr char toUpper(
char c )
noexcept;
667 [[nodiscard]]
inline constexpr bool isUriReserved( std::string_view str )
noexcept;
699 [[nodiscard]]
inline std::string
urlEncode( std::string_view str );
710 [[nodiscard]]
inline std::string
urlDecode( std::string_view str )
noexcept;
725 [[nodiscard]]
inline std::string
jsonEscape( std::string_view str );
736 [[nodiscard]]
inline std::string
jsonUnescape( std::string_view str )
noexcept;
755 [[nodiscard]]
inline std::string
xmlEscape( std::string_view str );
767 [[nodiscard]]
inline std::string
xmlUnescape( std::string_view str )
noexcept;
785 [[nodiscard]]
inline std::string
cppEscape( std::string_view str );
798 [[nodiscard]]
inline std::string
cppUnescape( std::string_view str )
noexcept;
813 [[nodiscard]]
inline std::string
truncate( std::string_view str,
size_t maxLength );
826 [[nodiscard]]
inline std::string
truncate( std::string_view str,
size_t maxLength, std::string_view ellipsis );
839 [[nodiscard]]
inline std::string
wordWrap( std::string_view str,
size_t width );
851 [[nodiscard]]
inline std::string
indent( std::string_view str,
size_t spaces );
862 [[nodiscard]]
inline std::string
dedent( std::string_view str );
877 [[nodiscard]]
inline constexpr int compareIgnoreCase( std::string_view lhs, std::string_view rhs )
noexcept;
889 [[nodiscard]]
inline constexpr int naturalCompare( std::string_view lhs, std::string_view rhs )
noexcept;
900 [[nodiscard]]
inline constexpr std::string_view
commonPrefix( std::string_view lhs, std::string_view rhs )
noexcept;
911 [[nodiscard]]
inline constexpr std::string_view
commonSuffix( std::string_view lhs, std::string_view rhs )
noexcept;
924 [[nodiscard]]
inline constexpr bool isIpv4Address( std::string_view str )
noexcept;
933 [[nodiscard]]
inline constexpr bool isIpv6Address( std::string_view str )
noexcept;
948 [[nodiscard]]
inline constexpr bool isHostname( std::string_view str )
noexcept;
957 [[nodiscard]]
inline constexpr bool isIdnHostname( std::string_view str )
noexcept;
967 [[nodiscard]]
inline constexpr bool isDomainName( std::string_view str )
noexcept;
981 [[nodiscard]]
inline constexpr bool isPortNumber( std::string_view str )
noexcept;
999 std::string_view& host,
1000 uint16_t& port )
noexcept;
1015 [[nodiscard]]
inline constexpr bool isDateTime( std::string_view str )
noexcept;
1025 [[nodiscard]]
inline constexpr bool isDate( std::string_view str )
noexcept;
1035 [[nodiscard]]
inline constexpr bool isTime( std::string_view str )
noexcept;
1045 [[nodiscard]]
inline constexpr bool isDuration( std::string_view str )
noexcept;
1060 [[nodiscard]]
inline constexpr bool isEmail( std::string_view str )
noexcept;
1069 [[nodiscard]]
inline constexpr bool isIdnEmail( std::string_view str )
noexcept;
1083 [[nodiscard]]
inline constexpr bool isUuid( std::string_view str )
noexcept;
1097 [[nodiscard]]
inline constexpr bool isUri( std::string_view str )
noexcept;
1119 [[nodiscard]]
inline constexpr bool isUriTemplate( std::string_view str )
noexcept;
1133 [[nodiscard]]
inline constexpr bool isIri( std::string_view str )
noexcept;
1158 [[nodiscard]]
inline constexpr bool isJsonPointer( std::string_view str )
noexcept;
1171#include "nfx/detail/string/Utils.inl"
constexpr bool isAlphaNumeric(char c) noexcept
Check if character is ASCII alphanumeric.
std::string truncate(std::string_view str, size_t maxLength)
Truncate string to maximum length.
constexpr std::string_view substringAfter(std::string_view str, std::string_view delimiter) noexcept
Extract substring after first occurrence of delimiter.
std::string toLower(std::string_view str)
Convert string to lowercase.
constexpr std::string_view extractBetween(std::string_view str, std::string_view start, std::string_view end) noexcept
Extract substring between start and end delimiters.
std::string replaceAll(std::string_view str, std::string_view oldStr, std::string_view newStr)
Replace all occurrences of substring with replacement.
constexpr std::string_view removePrefix(std::string_view str, std::string_view prefix) noexcept
Remove prefix from string if present.
constexpr bool isIdnEmail(std::string_view str) noexcept
Validate Internationalized email address format (EAI/SMTPUTF8).
constexpr bool isIdnHostname(std::string_view str) noexcept
Validate Internationalized Domain Name (IDN) hostname format.
bool iequals(std::string_view lhs, std::string_view rhs) noexcept
Fast case-insensitive string comparison.
constexpr std::size_t lastIndexOf(std::string_view str, std::string_view substr) noexcept
Find last occurrence of substring.
std::string reverse(std::string_view str)
Reverse a string.
constexpr bool isNullOrWhiteSpace(std::string_view str) noexcept
Fast check if string is null, empty, or contains only whitespace.
std::string replaceIf(std::string_view str, Predicate pred, char replacement)
Replace characters matching predicate with replacement character.
constexpr bool isEmpty(std::string_view str) noexcept
Fast check if string is empty.
std::string jsonEscape(std::string_view str)
Escape string for use in JSON (RFC 8259).
std::string toUpper(std::string_view str)
Convert string to uppercase.
constexpr bool isDuration(std::string_view str) noexcept
Validate ISO 8601 duration format.
bool tryParseEndpoint(std::string_view endpoint, std::string_view &host, uint16_t &port) noexcept
Parse network endpoint into host and port.
constexpr bool isUuid(std::string_view str) noexcept
Validate UUID format (RFC 4122).
std::string repeat(std::string_view str, std::size_t count)
Repeat string specified number of times.
constexpr std::string_view substringAfterLast(std::string_view str, std::string_view delimiter) noexcept
Extract substring after last occurrence of delimiter.
std::string replace(std::string_view str, std::string_view oldStr, std::string_view newStr)
Replace first occurrence of substring with replacement.
constexpr bool equals(std::string_view lhs, std::string_view rhs) noexcept
Fast case-sensitive string comparison.
constexpr std::string_view trimStart(std::string_view str) noexcept
Remove leading whitespace from string.
constexpr bool isPortNumber(std::string_view str) noexcept
Validate port number string (RFC 6335).
constexpr bool isEmail(std::string_view str) noexcept
Validate email address format (RFC 5321).
constexpr bool isUriTemplate(std::string_view str) noexcept
Validate URI Template format (RFC 6570).
constexpr bool isTime(std::string_view str) noexcept
Validate RFC 3339 full-time format.
constexpr bool isUriReserved(char c) noexcept
Check if character is URI reserved (RFC 3986 Section 2.2).
constexpr std::string_view trimIf(std::string_view str, Predicate pred) noexcept
Remove leading and trailing characters matching predicate.
constexpr bool isAlpha(char c) noexcept
Check if character is ASCII alphabetic.
std::string join(const Container &elements, std::string_view delimiter)
Join container elements with delimiter.
constexpr bool hasExactLength(std::string_view str, std::size_t expectedLength) noexcept
Fast check if string has exact length.
std::string urlDecode(std::string_view str) noexcept
Decode percent-encoded URL string (RFC 3986).
constexpr bool isDomainName(std::string_view str) noexcept
Validate domain name format (RFC 1035).
constexpr bool isIriReference(std::string_view str) noexcept
Validate IRI-reference format (RFC 3987).
constexpr bool isUri(std::string_view str) noexcept
Validate URI format (RFC 3986).
constexpr std::size_t countIf(std::string_view str, Predicate pred) noexcept
Count characters matching predicate.
constexpr bool isRelativeJsonPointer(std::string_view str) noexcept
Validate relative JSON Pointer format.
constexpr std::string_view commonPrefix(std::string_view lhs, std::string_view rhs) noexcept
Find longest common prefix of two strings.
std::string removeAll(std::string_view str, char ch)
Remove all occurrences of a character from string.
constexpr std::size_t indexOf(std::string_view str, std::string_view substr) noexcept
Find first occurrence of substring.
std::string center(std::string_view str, std::size_t width, char fillChar=' ')
Center string within specified width.
std::string removeIf(std::string_view str, Predicate pred)
Remove all characters matching a predicate from string.
constexpr bool isDate(std::string_view str) noexcept
Validate RFC 3339 full-date format.
std::string cppEscape(std::string_view str)
Escape string for use as C/C++ string literal.
std::string cppUnescape(std::string_view str) noexcept
Unescape C/C++ string literal escape sequences.
std::string padLeft(std::string_view str, std::size_t width, char fillChar=' ')
Pad string on the left to reach specified width.
constexpr std::string_view trimEnd(std::string_view str) noexcept
Remove trailing whitespace from string.
std::size_t count(std::string_view str, std::string_view substr) noexcept
Count occurrences of substring in string.
constexpr std::size_t findIf(std::string_view str, Predicate pred) noexcept
Find first character matching predicate.
constexpr bool endsWith(std::string_view str, std::string_view suffix) noexcept
Fast check if string ends with suffix.
constexpr std::string_view trimStartIf(std::string_view str, Predicate pred) noexcept
Remove leading characters matching predicate.
std::string collapseWhitespace(std::string_view str)
Collapse consecutive whitespace characters to single space.
constexpr std::string_view commonSuffix(std::string_view lhs, std::string_view rhs) noexcept
Find longest common suffix of two strings.
std::string indent(std::string_view str, size_t spaces)
Add indentation to all lines.
std::string xmlEscape(std::string_view str)
Escape string for use in XML/HTML content.
constexpr std::string_view removeSuffix(std::string_view str, std::string_view suffix) noexcept
Remove suffix from string if present.
std::string urlEncode(std::string_view str)
Encode string for use in URLs (percent-encoding per RFC 3986).
std::size_t countOverlapping(std::string_view str, std::string_view substr) noexcept
Count overlapping occurrences of substring in string.
constexpr std::size_t findIfNot(std::string_view str, Predicate pred) noexcept
Find first character NOT matching predicate.
std::string jsonUnescape(std::string_view str) noexcept
Unescape JSON string literal (RFC 8259).
constexpr bool startsWith(std::string_view str, std::string_view prefix) noexcept
Fast check if string starts with prefix.
std::string xmlUnescape(std::string_view str) noexcept
Unescape XML/HTML entity references.
constexpr bool isIpv4Address(std::string_view str) noexcept
Validate IPv4 address format (RFC 791).
constexpr bool isDigit(char c) noexcept
Check if character is ASCII digit.
constexpr int compareIgnoreCase(std::string_view lhs, std::string_view rhs) noexcept
Case-insensitive three-way comparison.
std::string wordWrap(std::string_view str, size_t width)
Wrap text to specified width.
constexpr bool isIri(std::string_view str) noexcept
Validate IRI format (RFC 3987).
constexpr std::string_view trimEndIf(std::string_view str, Predicate pred) noexcept
Remove trailing characters matching predicate.
constexpr std::string_view substringBeforeLast(std::string_view str, std::string_view delimiter) noexcept
Extract substring before last occurrence of delimiter.
constexpr bool isDateTime(std::string_view str) noexcept
Validate RFC 3339 date-time format.
constexpr bool isWhitespace(char c) noexcept
Check if character is whitespace.
constexpr std::string_view substringBefore(std::string_view str, std::string_view delimiter) noexcept
Extract substring before first occurrence of delimiter.
constexpr bool isIpv6Address(std::string_view str) noexcept
Validate IPv6 address format (RFC 4291, RFC 5952).
constexpr bool isUriReference(std::string_view str) noexcept
Validate URI-reference format (RFC 3986).
constexpr bool isJsonPointer(std::string_view str) noexcept
Validate JSON Pointer format (RFC 6901).
constexpr bool contains(std::string_view str, std::string_view substr) noexcept
Fast check if string contains substring.
std::string dedent(std::string_view str)
Remove common leading whitespace from all lines.
constexpr int naturalCompare(std::string_view lhs, std::string_view rhs) noexcept
Natural sorting comparison (handles embedded numbers).
constexpr bool isAllDigits(std::string_view str) noexcept
Check if string contains only ASCII digits.
std::string removeWhitespace(std::string_view str)
Remove all whitespace characters from string.
constexpr bool isHostname(std::string_view str) noexcept
Validate hostname format (RFC 1123).
std::string padRight(std::string_view str, std::size_t width, char fillChar=' ')
Pad string on the right to reach specified width.
constexpr std::string_view trim(std::string_view str) noexcept
Remove leading and trailing whitespace from string.
constexpr bool isUriUnreserved(char c) noexcept
Check if character is URI unreserved (RFC 3986 Section 2.3).
constexpr bool isHexDigit(char c) noexcept
Check if character is ASCII hexadecimal digit.