xtralib  0.1.0
A simple header-based drop-in library
Macros | Functions
string.h File Reference

New functions and types related to string and string manipulation. More...

#include <string.h>
#include <stdlib.h>

Go to the source code of this file.

Macros

#define MAX_CHARSET_SIZE   256
 
#define SUB   0x1A
 

Functions

char * strdupl (const char *str)
 Implmentation of 'strdup'. More...
 
char * strcov (char *str, const char *charset)
 Checks if string covers all of charset. More...
 
wchar_t * wcscov (wchar_t *str, const wchar_t *charset)
 
const char * strset (const char *string, const char *charset)
 Checks to see if string contains only characters in charset. More...
 
const wchar_t * wcsset (const wchar_t *string, const wchar_t *charset)
 
char * strpcat (char *dest, const char *src, size_t pos)
 concatenate but at a give 'p' position. More...
 
wchar_t * wcspcat (wchar_t *dest, const wchar_t *src, size_t pos)
 
char * chrcat (char *dest, const char src)
 Concatenate a char on to the end of a string. More...
 
wchar_t * wccat (wchar_t *dest, const wchar_t src)
 
int strchrn (const char *string, char ch)
 Get number of times that ch appears in string. More...
 
int wcswcn (const wchar_t *string, wchar_t ch)
 (Wide-char variant) Get number of times that ch appears in string. More...
 
wchar_t * wcsrev (wchar_t *str)
 Reverses the wide character string. More...
 
char * strpre (char *str, char chr)
 
wchar_t * wcspre (wchar_t *str, wchar_t chr)
 Prepends a character to a wide character string. More...
 
char * strpres (char *str, char *pre)
 
wchar_t * wcspres (wchar_t *str, wchar_t *pre)
 
wchar_t * iswcsdigit (wchar_t *string)
 Confirms that wcstring is entirely composed on numbers.
 
long hash (const char *str)
 

Detailed Description

New functions and types related to string and string manipulation.

Author
yung-turabian
Date
4 8 2024

Function Documentation

◆ chrcat()

char* chrcat ( char *  dest,
const char  src 
)

Concatenate a char on to the end of a string.

Returns
dest string

◆ strchrn()

int strchrn ( const char *  string,
char  ch 
)

Get number of times that ch appears in string.

Returns
the number of instances.

◆ strcov()

char* strcov ( char *  str,
const char *  charset 
)

Checks if string covers all of charset.

Warning
will not care if a character not present in the charset is found.
Returns
string on success or NULL on failure.

◆ strdupl()

char* strdupl ( const char *  str)

Implmentation of 'strdup'.

Returns
copy of string or NULL if something went wrong.

◆ strpcat()

char* strpcat ( char *  dest,
const char *  src,
size_t  pos 
)

concatenate but at a give 'p' position.

Returns
dest string.

◆ strset()

const char* strset ( const char *  string,
const char *  charset 
)

Checks to see if string contains only characters in charset.

Returns
string if true, NULL if a unexpected character is found.

◆ wcspre()

wchar_t* wcspre ( wchar_t *  str,
wchar_t  chr 
)

Prepends a character to a wide character string.

Returns
on success return string.

◆ wcsrev()

wchar_t* wcsrev ( wchar_t *  str)

Reverses the wide character string.

Returns
on success return string.

◆ wcswcn()

int wcswcn ( const wchar_t *  string,
wchar_t  ch 
)

(Wide-char variant) Get number of times that ch appears in string.

Returns
the number of instances.