Added lastIndexOf helper function
This commit is contained in:
parent
ef0ab58add
commit
f0398b717b
@ -49,3 +49,21 @@ char *dateTimeFormater(char *pointer, const uint8_t value, const char character)
|
||||
|
||||
return pointer;
|
||||
}
|
||||
|
||||
char *lastIndexOf(char *str, const char character)
|
||||
{
|
||||
char *last(NULL), *current(str);
|
||||
do
|
||||
{
|
||||
current = strchr(current, character);
|
||||
if(current != NULL)
|
||||
{
|
||||
last = current;
|
||||
if(*(current+1) == '\0')break;
|
||||
|
||||
current += 1;
|
||||
}
|
||||
}while(current != NULL);
|
||||
|
||||
return last;
|
||||
}
|
||||
|
@ -55,6 +55,8 @@ typedef struct viewLink{
|
||||
|
||||
char *addChar(char *pointer, const char character);
|
||||
|
||||
char *lastIndexOf(char *str, const char character);
|
||||
|
||||
char *dateTimeFormater(char *pointer, const uint8_t value, const char character);
|
||||
|
||||
#endif //DEFINITION_H
|
||||
|
Loading…
Reference in New Issue
Block a user