Faker C++
Loading...
Searching...
No Matches
string.h File Reference
#include <algorithm>
#include <array>
#include <chrono>
#include <cstdint>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <limits>
#include <map>
#include <optional>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <string_view>
#include "faker-cxx/export.h"
#include "random_generator.h"
Include dependency graph for string.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  faker::string::CharCount
 

Namespaces

namespace  faker
 
namespace  faker::string
 

Typedefs

using faker::string::GuaranteeMap = std::map<char, CharCount>
 

Enumerations

enum class  faker::string::Uuid {
  faker::string::V1 , faker::string::V3 , faker::string::V4 , faker::string::V5 ,
  faker::string::V6 , faker::string::V7 , faker::string::V8
}
 
enum class  faker::string::StringCasing { faker::string::Mixed , faker::string::Lower , faker::string::Upper }
 

Functions

FAKER_CXX_EXPORT bool faker::string::isValidGuarantee (GuaranteeMap &guarantee, std::set< char > &targetCharacters, unsigned length)
 Checks if the given guarantee map is valid for given targetCharacters and length.
 
FAKER_CXX_EXPORT std::string faker::string::generateAtLeastString (const GuaranteeMap &guarantee)
 Generates the least required string for a given guarantee map.
 
FAKER_CXX_EXPORT std::string faker::string::uuid (Uuid uuid=Uuid::V4)
 Generates an Universally Unique Identifier, defaults to V4.
 
FAKER_CXX_EXPORT std::string faker::string::ulid (time_t refDate=std::time(nullptr))
 Generates an Universally Unique Lexicographically Sortable Identifier.
 
FAKER_CXX_EXPORT std::string faker::string::sample (unsigned length=10)
 Returns a string containing UTF-16 chars between 33 and 125 (`!` to `}`).
 
FAKER_CXX_EXPORT std::string faker::string::sample (GuaranteeMap &&guarantee, unsigned length=10)
 Returns a string containing UTF-16 chars between 33 and 125 (`!` to `}`).
 
FAKER_CXX_EXPORT std::string faker::string::symbol (unsigned minLength=1, unsigned maxLength=10)
 Returns a string containing "~`!@#$%^&*()_-+={[}]|:;\"'<,>.?/".
 
FAKER_CXX_EXPORT std::string faker::string::fromCharacters (const std::string &characters, unsigned length=1)
 Generates a string consisting of given characters.
 
FAKER_CXX_EXPORT std::string faker::string::fromCharacters (GuaranteeMap &&guarantee, const std::string &characters, unsigned length=1)
 Generates a string consisting of given characters.
 
FAKER_CXX_EXPORT std::string faker::string::alpha (unsigned length=1, StringCasing casing=StringCasing::Mixed, const std::string &excludeCharacters="")
 Generates a string consisting of letters in the English alphabet.
 
FAKER_CXX_EXPORT std::string faker::string::alpha (GuaranteeMap &&guarantee, unsigned length=1, StringCasing casing=StringCasing::Mixed)
 Generates a string consisting of letters in the English alphabet.
 
FAKER_CXX_EXPORT std::string faker::string::alphanumeric (unsigned length=1, StringCasing casing=StringCasing::Mixed, const std::string &excludeCharacters="")
 Generates a string consisting of alpha characters and digits.
 
FAKER_CXX_EXPORT std::string faker::string::alphanumeric (GuaranteeMap &&guarantee, unsigned length=1, StringCasing casing=StringCasing::Mixed)
 Generates a string consisting of alpha characters and digits.
 
FAKER_CXX_EXPORT std::string faker::string::numeric (unsigned length=1, bool allowLeadingZeros=true)
 Generates a given length string of digits.
 
FAKER_CXX_EXPORT std::string faker::string::numeric (GuaranteeMap &&guarantee, unsigned length=1, bool allowLeadingZeros=true)
 Generates a given length string of digits.
 
FAKER_CXX_EXPORT std::string faker::string::nanoId (int length)
 Generates a unique, URL-safe string identifier of the specified length.
 
FAKER_CXX_EXPORT std::string faker::string::nanoId ()
 Generates a unique, URL-safe string identifier of default length.
 
FAKER_CXX_EXPORT std::string faker::string::nanoId (int minLength, int maxLength)
 Generates a unique, URL-safe string identifier of random length within a specified range.