#include <cstr_util.hpp>
|
| static bool | IsAllCharUnique (const char str[]) |
| | check if all characater in a string is unique More...
|
| |
| static void | Reverse (char str[]) |
| | reverse the passed string More...
|
| |
| template<size_t N> |
| static bool | IsPermutation (const char a[], const char b[]) |
| | check if a string passed is a permutation of the other More...
|
| |
| static size_t | Replace (const char subject[], char result[], char search, char replace[]) |
| | replace all occurrences of a character with some string More...
|
| |
| template<typename Type > |
| static size_t | NumToDecimalString (Type num, char str[]) |
| |
| static size_t | CharCountEncoding (const char subject[], char encstr[]) |
| | encode a string such that every repeated character is encoded as the character followed by count. More...
|
| |
| static size_t | CharCountCompress (const char subject[], char compstr[]) |
| | compress a string such that every repeated character is encoded as the character followed by count. More...
|
| |
| static size_t | StrPos (const char *haystack, const char *needle, size_t offset=0) |
| | Find the position of the first occurrence of a substring in a text. More...
|
| |
| static bool | isSubstring (const char *string, const char *substring) |
| | check if a string is a substring of other More...
|
| |
| static bool | isRotation (const char *str, const char *rstr) |
| | check if a string is a roation of another More...
|
| |
Definition at line 33 of file cstr_util.hpp.
| static size_t scire::CharStringUtil::CharCountCompress |
( |
const char |
subject[], |
|
|
char |
compstr[] |
|
) |
| |
|
inlinestatic |
compress a string such that every repeated character is encoded as the character followed by count.
e.g. aabcccaaaa -> a2b1c3a4. If encoded string is not smaller then return original string.
- Returns
- lenght of encoded string
- Parameters
-
| subject | string to encode |
| compstr | encoded string |
Definition at line 183 of file cstr_util.hpp.
| static size_t scire::CharStringUtil::CharCountEncoding |
( |
const char |
subject[], |
|
|
char |
encstr[] |
|
) |
| |
|
inlinestatic |
encode a string such that every repeated character is encoded as the character followed by count.
e.g. aabcccaaaa -> a2b1c3a4
- Returns
- lenght of encoded string
- Parameters
-
| subject | string to encode |
| encstr | encoded string |
Definition at line 149 of file cstr_util.hpp.
| static bool scire::CharStringUtil::IsAllCharUnique |
( |
const char |
str[] | ) |
|
|
inlinestatic |
check if all characater in a string is unique
- Returns
- false if at least one char appear more than once in the string
- Parameters
-
Definition at line 40 of file cstr_util.hpp.
template<size_t N>
| static bool scire::CharStringUtil::IsPermutation |
( |
const char |
a[], |
|
|
const char |
b[] |
|
) |
| |
|
inlinestatic |
check if a string passed is a permutation of the other
Definition at line 73 of file cstr_util.hpp.
| static bool scire::CharStringUtil::isRotation |
( |
const char * |
str, |
|
|
const char * |
rstr |
|
) |
| |
|
inlinestatic |
check if a string is a roation of another
Definition at line 228 of file cstr_util.hpp.
| static bool scire::CharStringUtil::isSubstring |
( |
const char * |
string, |
|
|
const char * |
substring |
|
) |
| |
|
inlinestatic |
check if a string is a substring of other
- Parameters
-
| string | text to find substring in (haystack) |
| substring | substring to look for (needle) |
Definition at line 216 of file cstr_util.hpp.
template<typename Type >
| static size_t scire::CharStringUtil::NumToDecimalString |
( |
Type |
num, |
|
|
char |
str[] |
|
) |
| |
|
inlinestatic |
| static size_t scire::CharStringUtil::Replace |
( |
const char |
subject[], |
|
|
char |
result[], |
|
|
char |
search, |
|
|
char |
replace[] |
|
) |
| |
|
inlinestatic |
replace all occurrences of a character with some string
- Parameters
-
| subject | string to operate on |
| result | result string |
| search | character to replace |
| replace | string to replace with |
Definition at line 99 of file cstr_util.hpp.
| static void scire::CharStringUtil::Reverse |
( |
char |
str[] | ) |
|
|
inlinestatic |
reverse the passed string
- Parameters
-
Definition at line 58 of file cstr_util.hpp.
| static size_t scire::CharStringUtil::StrPos |
( |
const char * |
haystack, |
|
|
const char * |
needle, |
|
|
size_t |
offset = 0 |
|
) |
| |
|
inlinestatic |
Find the position of the first occurrence of a substring in a text.
- Returns
- position (index) of first occurrence of substring in text if found, if not found then the lenght of text
- Parameters
-
| haystack | text to search in |
| needle | substring to look for |
| offset | offset to start search from |
Definition at line 204 of file cstr_util.hpp.
The documentation for this class was generated from the following file: