libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_string.h File Reference

Go to the source code of this file.

Functions

Per-Character

Methods for dealing with individual ASCII characters

int gblAsciiDigitValue (char c)
 
int gblAsciiHexDigitValue (char c)
 
C Strings

Methods for operating on NULL-terminated C strings

size_t gblStrnlen (const char *pStr1, size_t length)
 
int gblStrCaseCmp (const char *pStr1, const char *pStr2)
 
int gblStrnCaseCmp (const char *pStr1, const char *pStr2, size_t length)
 
char * gblStrCaseStr (const char *pStr, const char *pSub)
 
char * gblStrdup (const char *pString)
 
char * gblStrndup (const char *pString, size_t length)
 
char * gblStrnReverse (char *pString, size_t length)
 

Detailed Description

Low-level C string and character-based functions.

This file contains the lowest-level string API for working with individual characters or C strings.

Note
Typically, it's much easier to work with higher-level string APIs built around these utilities.
See also
GblStringView, GblStringRef, GblStringBuffer
Todo:
  • gblStrdupa()
  • gblStrndupa()
  • Unit tests
  • Consider moving bulk of GblStringView operations
Author
2023 Falco Girgis

Definition in file gimbal_string.h.

Function Documentation

◆ gblAsciiDigitValue()

int gblAsciiDigitValue ( char  c)

Returns the numeric value of the given base-10 ASCII digit.

◆ gblAsciiHexDigitValue()

int gblAsciiHexDigitValue ( char  c)

Returns the numeric value of the given hexadecimal ASCII digit.

◆ gblStrnlen()

size_t gblStrnlen ( const char *  pStr1,
size_t  length 
)

Returns the length of the given NULL-terminated C string or len, if it's less than it's length.

◆ gblStrCaseCmp()

int gblStrCaseCmp ( const char *  pStr1,
const char *  pStr2 
)

Compares the two NULL-terminaed C strings without case-sensitivity.

◆ gblStrnCaseCmp()

int gblStrnCaseCmp ( const char *  pStr1,
const char *  pStr2,
size_t  length 
)

Compares up to length bytes of the two C strings without case-sensitivity.

◆ gblStrCaseStr()

char * gblStrCaseStr ( const char *  pStr,
const char *  pSub 
)

Searches for the beginning of the pSub substring within pStr.

◆ gblStrdup()

char * gblStrdup ( const char *  pString)

Duplicates the given string, returning a new one allocatedon the heap.

◆ gblStrndup()

char * gblStrndup ( const char *  pString,
size_t  length 
)

Duplicates up to length bytes of the given string on the heap.

◆ gblStrnReverse()

char * gblStrnReverse ( char *  pString,
size_t  length 
)

Reverses up to length bytes within the given character array.