My library
Library for common tasks
Functions
strings.h File Reference

Common tasks with strings. More...

#include "types.h"
Include dependency graph for strings.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

string getString ()
 Reads from terminal a string of arbitrary length. More...
 
byte endsWith (const string str, const string suffix)
 Check if a string ends with the specified substring. More...
 
string changeLastCharacter (const string str, char newCharacter)
 Get a tring with different last character. More...
 
string copyOf (const string src)
 Get a copy of the given string. More...
 

Detailed Description

Common tasks with strings.

Author
Pietro Firpo (pietr.nosp@m.o.fi.nosp@m.rpo@p.nosp@m.m.me)

Function Documentation

◆ changeLastCharacter()

string changeLastCharacter ( const string  str,
char  newCharacter 
)

Get a tring with different last character.

Parameters
strThe string you want to change the last character
newCharacterThe character you want to set as last character
Returns
A pointer to a string with the same characters of str and newCharacter as last character or the return code of the function
Return values
NULLErrors occurred during the execution of the function

◆ copyOf()

string copyOf ( const string  src)

Get a copy of the given string.

Parameters
srcThe string to be copied
Returns
A pointer to the copy of the given string

◆ endsWith()

byte endsWith ( const string  str,
const string  suffix 
)

Check if a string ends with the specified substring.

Parameters
strThe string to be inspected
suffixThe string you want to check if string ends with
Returns
The return code of the function
Return values
TRUEstr ends with suffix
FALSEstr does not end with suffix

◆ getString()

string getString ( )

Reads from terminal a string of arbitrary length.

Returns
A char pointer to the first character of the string or the return code of the function
Return values
NULLErrors occurred during the execution of the function