Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
stringUtils.hpp File Reference
#include "core/concepts.hpp"
#include "core/exception.hpp"
#include <algorithm>
#include <array>
#include <charconv>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <ranges>
#include <string_view>
#include <vector>
Include dependency graph for stringUtils.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  iv
 
namespace  iv::utils
 

Functions

std::string iv::utils::stringJoin (const std::vector< std::string > &strings, char delim)
 
uint32_t iv::utils::stringToIpv4 (std::string_view str)
 
std::string iv::utils::ipv4ToString (uint32_t ip)
 
bool iv::utils::hostWildcardMatch (std::string_view issued_, std::string_view host_)
 
template<typename CharT1 , typename CharT2 >
requires std::convertible_to<CharT1, char> && std::convertible_to<CharT2, char>
int32_t iv::utils::compareSubstring (const CharT1 *str1, const CharT2 *str2, std::size_t length)
 Simple comparator of x chars where x is the length provided.
 
template<typename StringType >
requires std::convertible_to<StringType, const char *>
void iv::utils::appendToString (std::string *strResult, StringType str)
 Concatenate two string.
 
template<typename StringType , typename DelimiterType >
requires std::is_convertible_v<StringType, std::string> || (std::is_convertible_v<StringType, std::string_view> && (std::is_convertible_v<DelimiterType, std::string> || std::is_same_v<DelimiterType, typename StringType::value_type>) )
std::vector< StringType > iv::utils::splitOn (const StringType &str, const DelimiterType &delim)
 
template<typename StringType >
requires std::is_convertible_v<StringType, std::string> or std::is_convertible_v<StringType, std::string_view>
std::string iv::utils::truncate (const StringType &str, size_t length, bool show_ellipsis=true)
 
template<iv::concepts::StringRepresentable T1, iv::concepts::StringRepresentable T2>
bool iv::utils::isEqualStringsCaseInsensitive (const T1 &str1, const T2 &str2)
 
template<iv::concepts::StringRepresentable T1, iv::concepts::StringRepresentable T2>
bool iv::utils::isEqual (const T1 &str1, const T2 &str2)
 
void iv::utils::replaceSubString (std::string &source, const std::string &strToSearch, const std::string &strToReplace)
 Look for a substring into a string and when it is found, replace it for another substring.
 
void iv::utils::replaceChar (std::string *str, char charSearching, char charToChange)
 Look for a character into a string and when it is found, replace it for another character.
 
std::string iv::utils::createWithInitialization (char car, uint64_t numChars)
 
std::optional< size_t > iv::utils::findCharacterInString (std::string_view str, char car)
 
bool iv::utils::isAlphaNumericCharacter (char car)
 
bool iv::utils::isAlphabeticCharacter (char car)
 
bool iv::utils::isSpecialRealNumberCharacter (char car)
 
bool iv::utils::isSpecialIntegerCharacter (char car)
 
bool iv::utils::isDigitCharacter (char car)
 
bool iv::utils::isValidRealNumberCharacter (char car)
 
bool iv::utils::isValidIntegerCharacter (char car)
 
bool iv::utils::isHexadecimalCharacter (char car)
 
bool iv::utils::isHexadecimalString (const std::string &str)
 
uint8_t iv::utils::calculateDecimalDigits (std::string_view str)
 
uint8_t iv::utils::calculateDecimalDigits (double precision)
 
template<typename T >
requires iv::concepts::IntegerType<T> || iv::concepts::FloatingPointType<T>
std::string iv::utils::formatNumber (T number, std::optional< uint8_t > precision=std::nullopt)
 Check if a string is a number, only applies precision to floating point numbers.
 
std::string iv::utils::demangle (const std::type_info &ti)
 
std::string iv::utils::iso88591_to_utf8 (const std::string_view input)