ACDC Senior Project v1.0.0
Senior Project for Textron Aviation
Loading...
Searching...
No Matches
ACDC_string.h File Reference

Header file containing String functions. More...

#include "ACDC_stdbool.h"
#include "ACDC_stdint.h"

Go to the source code of this file.

Functions

char * StringCopy (char *dest, const char *source)
 Copies the string pointed by source (including the null character) to the destination dest.
 
int32_t StringCompare (const char *str1, const char *str2)
 Compares two strings character by character. Returns 0 if the strings are equal, >0 if the first non-matching character in str1 is greater than str2, and <0 if the first non-matching character in str1 is less than str2.
 
int32_t StringLength (const char *str)
 Calculates the length of the string str.
 
char * StringConcat (char *dest, const char *source)
 Appends the content of the string source to the end of the string dest.
 
int32_t StringIndexOf (const char *str, char c)
 Finds and returns the index of first occurance the character c in the string str.
 
char * StringSubstring (char *str, int32_t index)
 Returns a substring of the input string str starting from the specified index.
 
bool StringStartsWith (char *str, const char *compareWith)
 Checks if the given string str starts with the specified substring compareWith.
 
bool StringEndsWith (const char *str, const char *compareWith)
 Checks if the given string str ends with the specified substring compareWith.
 
char * StringToUpper (char *str)
 Converts all lowercase characters a-z in the string str to uppercase.
 
char * StringToLower (char *str)
 Converts all uppercase characters A-Z in the string str to lowercase.
 
bool StringIsUpper (const char *str)
 Checks if all characters in the input string are uppercase characters (can only contain characters)
 
bool StringIsLower (const char *str)
 Checks if all characters in the input string are lowercase characters (can only contain characters)
 
bool StringIsNumeric (const char *str)
 Checks if all characters in the input string are numeric.
 
bool StringIsAlphabetic (const char *str)
 Checks if all characters in the input string are alphabetic.
 
bool StringIsAlphanumeric (const char *str)
 Checks if all characters in the input string are alphanumeric.
 
char * StringConvert (int32_t num)
 Converts an int32_t into a string.
 

Detailed Description

Header file containing String functions.

Author
Devin Marx
Version
0.2
Date
2023-1-16

Function Documentation

◆ StringCompare()

int32_t StringCompare ( const char * str1,
const char * str2 )

Compares two strings character by character. Returns 0 if the strings are equal, >0 if the first non-matching character in str1 is greater than str2, and <0 if the first non-matching character in str1 is less than str2.

Parameters
str1First string to compare with
str2Second string to compare with
Returns
0 if str1 == str2, >0 if the first non-matching character in str1 > str2, and <0 if the first non-matching character in str1 < str2.

◆ StringConcat()

char * StringConcat ( char * dest,
const char * source )

Appends the content of the string source to the end of the string dest.

Parameters
destDestination string to which the source string will be appended
sourceSource string to be appended to the destination
Returns
Pointer to the concatenated string (dest + source). The original string is modified

◆ StringConvert()

char * StringConvert ( int32_t num)

Converts an int32_t into a string.

Parameters
numInteger to convert into a string
Returns
Pointer to a buffer that contains the converted string

◆ StringCopy()

char * StringCopy ( char * dest,
const char * source )

Copies the string pointed by source (including the null character) to the destination dest.

Parameters
destinationDestination buffer to copy the source string to
sourceString to be copied
Returns
Pointer to the copied string.

◆ StringEndsWith()

bool StringEndsWith ( const char * str,
const char * compareWith )

Checks if the given string str ends with the specified substring compareWith.

Parameters
strInput string
compareWithSubstring to check for at the end of the string str
Returns
True if the string str ends with compareWith, otherwise false.

◆ StringIndexOf()

int32_t StringIndexOf ( const char * str,
char c )

Finds and returns the index of first occurance the character c in the string str.

Parameters
strString to search
cCharacter to search for
Returns
Index of the char c in the string str. Returns -1 if the character is not found.

◆ StringIsAlphabetic()

bool StringIsAlphabetic ( const char * str)

Checks if all characters in the input string are alphabetic.

Parameters
strInput string to check
Returns
True if all characters are alphabetic, otherwise false.

◆ StringIsAlphanumeric()

bool StringIsAlphanumeric ( const char * str)

Checks if all characters in the input string are alphanumeric.

Parameters
strInput string to check
Returns
True if all characters are alphanumeric, otherwise false.

◆ StringIsLower()

bool StringIsLower ( const char * str)

Checks if all characters in the input string are lowercase characters (can only contain characters)

Parameters
strInput string to convert
Returns
Trueif all characters are lowercase characaters, otherwise false

◆ StringIsNumeric()

bool StringIsNumeric ( const char * str)

Checks if all characters in the input string are numeric.

Parameters
strInput string to check
Returns
True if all characters are numeric, otherwise false

◆ StringIsUpper()

bool StringIsUpper ( const char * str)

Checks if all characters in the input string are uppercase characters (can only contain characters)

Parameters
strInput string to convert
Returns
True if all characters are uppercase characters, otherwise false

◆ StringLength()

int32_t StringLength ( const char * str)

Calculates the length of the string str.

Parameters
strString to find the length of
Returns
Length of the string.

◆ StringStartsWith()

bool StringStartsWith ( char * str,
const char * compareWith )

Checks if the given string str starts with the specified substring compareWith.

Parameters
strInput string
compareWithSubstring to check for at the beginning of str
Returns
True if the string str starts with compareWith, otherwise false.

◆ StringSubstring()

char * StringSubstring ( char * str,
int32_t index )

Returns a substring of the input string str starting from the specified index.

Parameters
strInput string
indexStarting index of the substring
Returns
Pointer to the substring starting from the given index.

◆ StringToLower()

char * StringToLower ( char * str)

Converts all uppercase characters A-Z in the string str to lowercase.

Parameters
strInput string to convert
Returns
Pointer to the modified string

◆ StringToUpper()

char * StringToUpper ( char * str)

Converts all lowercase characters a-z in the string str to uppercase.

Parameters
strInput string to convert
Returns
Pointer to the modified string