Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
hgps::core::case_insensitive Struct Referencefinal

Case-insensitive operations on ASCII strings. More...

#include <string_util.h>

Classes

struct  comparator
 Case-insensitive ASCII strings comparator structure. More...
 

Static Public Member Functions

static std::weak_ordering compare (const std::string_view &left, const std::string_view &right) noexcept
 Weak-ordering case-insensitive ASCII strings comparer. More...
 
static bool equals (const std::string_view &left, const std::string_view &right) noexcept
 Compare two case-insensitive ASCII string for equality. More...
 
static bool contains (const std::string_view &text, const std::string_view &str) noexcept
 Checks whether a specified substring occurs within a ASCII string. More...
 
static bool contains (const std::vector< std::string > &source, const std::string_view &element) noexcept
 Checks whether a vector contains a ASCII strings element. More...
 
static bool starts_with (const std::string_view &text, const std::string_view &str) noexcept
 Determines whether the start of a ASCII string matches a specified string. More...
 
static bool ends_with (const std::string_view &text, const std::string_view &str) noexcept
 Determines whether the end of a ASCII string matches a specified string. More...
 
static int index_of (const std::vector< std::string > &source, const std::string_view &element) noexcept
 Finds the zero-based index of the first occurrence of an element in a vector. More...
 

Detailed Description

Case-insensitive operations on ASCII strings.

Member Function Documentation

◆ compare()

std::weak_ordering hgps::core::case_insensitive::compare ( const std::string_view &  left,
const std::string_view &  right 
)
staticnoexcept

Weak-ordering case-insensitive ASCII strings comparer.

Parameters
leftThe left string to compare
rightThe right string to compare
Returns
true if the string are equal, otherwise, false
Here is the call graph for this function:

◆ contains() [1/2]

bool hgps::core::case_insensitive::contains ( const std::string_view &  text,
const std::string_view &  str 
)
staticnoexcept

Checks whether a specified substring occurs within a ASCII string.

Parameters
textThe source string
strThe string to seek
Returns
true if the value occurs within the string, otherwise, false.
Here is the caller graph for this function:

◆ contains() [2/2]

bool hgps::core::case_insensitive::contains ( const std::vector< std::string > &  source,
const std::string_view &  element 
)
staticnoexcept

Checks whether a vector contains a ASCII strings element.

Parameters
sourceThe vector of strings
elementThe string to seek
Returns
true if the value occurs within the vector, otherwise, false.

◆ ends_with()

bool hgps::core::case_insensitive::ends_with ( const std::string_view &  text,
const std::string_view &  str 
)
staticnoexcept

Determines whether the end of a ASCII string matches a specified string.

Parameters
textThe source string.
strThe end string to compare
Returns
true if value matches the end of string; otherwise, false.

◆ equals()

bool hgps::core::case_insensitive::equals ( const std::string_view &  left,
const std::string_view &  right 
)
staticnoexcept

Compare two case-insensitive ASCII string for equality.

Parameters
leftThe left string to compare
rightThe right string to compare
Returns
true if the string are equal, otherwise, false
Here is the caller graph for this function:

◆ index_of()

int hgps::core::case_insensitive::index_of ( const std::vector< std::string > &  source,
const std::string_view &  element 
)
staticnoexcept

Finds the zero-based index of the first occurrence of an element in a vector.

Parameters
sourceThe vector of strings
elementThe element to locate
Returns
The zero-based index the element first occurrence, if found; otherwise, -1.
Here is the caller graph for this function:

◆ starts_with()

bool hgps::core::case_insensitive::starts_with ( const std::string_view &  text,
const std::string_view &  str 
)
staticnoexcept

Determines whether the start of a ASCII string matches a specified string.

Parameters
textThe source string.
strThe start string to compare
Returns
true if value matches the start of string; otherwise, false.

The documentation for this struct was generated from the following files: