v6502
The MOS 6502 Virtual Machine and Toolchain Infrastructure
Functions
String Manipulation Functions

Functions

void trimtaild (char *str)
 Destructively trim trailing whitespace with NUL.
 
void trimtailchard (char *str, char token)
 Destructively tail trim at first encounter of token char from the tail end.
 
void trimgreedytaild (char *str, size_t len)
 Destructively tail trim at first encounter of whitespace from the head end.
 
void trimgreedytailchard (char *str, char token)
 Destructively tail trim at first encounter of token char from the head end.
 
char * trimhead (const char *str, size_t len)
 Safely trim leading whitespace by pushing pointer.
 
char * trimheadchar (char *str, char token, size_t len)
 Safely trim head til first encounter of token char from the head end.
 
char * trimheadtospc (const char *str, size_t len)
 Safely trim head til first encounter of whitespace from the head end.
 
char * strnspc (const char *str, size_t len)
 Search string for first encounter of a space, safely. If no whitespace is found, a pointer to the end is returned.
 
char * strnpc (const char *str, size_t len)
 Search string for first encounter of a printable char (non-whitespace), safely. If no printable character is found, a pointer to the end is returned.
 
char * rev_strnspc (const char *stop, const char *start)
 Reverse search string for space, safely. More...
 
char * rev_strnpc (const char *stop, const char *start)
 Reverse search string for printable char (non-whitespace), safely. More...
 
const char * rev_strnchr (const char *stop, const char *start, const char chr)
 Reverse search string for character, safely. More...
 
char * strnchr (const char *str, char chr, size_t len)
 Safely search potentially unterminated string for character.
 

Detailed Description

Function Documentation

◆ rev_strnchr()

const char* rev_strnchr ( const char *  stop,
const char *  start,
const char  chr 
)

Reverse search string for character, safely.

Parameters
[in]startThe location in the string to start searching backwards from
[in]stopThe earliest location in the string to search up to, usually the beginning of the string
[in]chrThe character to look for

◆ rev_strnpc()

char* rev_strnpc ( const char *  stop,
const char *  start 
)

Reverse search string for printable char (non-whitespace), safely.

Parameters
[in]startThe location in the string to start searching backwards from
[in]stopThe earliest location in the string to search up to, usually the beginning of the string

◆ rev_strnspc()

char* rev_strnspc ( const char *  stop,
const char *  start 
)

Reverse search string for space, safely.

Parameters
[in]startThe location in the string to start searching backwards from
[in]stopThe earliest location in the string to search up to, usually the beginning of the string