Sane C++ Libraries
C++ Platform Abstraction Libraries
SC::StringAlgorithms Struct Reference

Algorithms operating on strings (glob / wildcard). More...

#include <StringView.h>

Static Public Member Functions

static bool matchWildcard (StringView s1, StringView s2)
 

Detailed Description

Algorithms operating on strings (glob / wildcard).


Example

SC_ASSERT(StringAlgorithms::matchWildcard("", ""));
SC_ASSERT(StringAlgorithms::matchWildcard("1?3", "123"));
SC_ASSERT(StringAlgorithms::matchWildcard("1*3", "12223"));
SC_ASSERT(StringAlgorithms::matchWildcard("*2", "12"));
SC_ASSERT(not StringAlgorithms::matchWildcard("*1", "12"));
SC_ASSERT(not StringAlgorithms::matchWildcard("*1", "112"));
SC_ASSERT(not StringAlgorithms::matchWildcard("**1", "112"));
SC_ASSERT(not StringAlgorithms::matchWildcard("*?1", "112"));
SC_ASSERT(StringAlgorithms::matchWildcard("1*", "12123"));
SC_ASSERT(StringAlgorithms::matchWildcard("*/myString", "myString/myString/myString"));
SC_ASSERT(StringAlgorithms::matchWildcard("**/myString", "myString/myString/myString"));
SC_ASSERT(not StringAlgorithms::matchWildcard("*/String", "myString/myString/myString"));
SC_ASSERT(StringAlgorithms::matchWildcard("*/Directory/File.cpp", "/Root/Directory/File.cpp"));

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