3 This file is part of the AVR-Crypto-Lib.
4 Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * \file string-extras.h
23 * \license GPLv3 or later
28 /** \fn stridentcnt_P(char* a, PGM_P b)
29 * \brief counts the number of identic chars
31 * This function compares the supplied strings and returns the index of the
32 * first char where the strings differ.
33 * \param a pointer to string in RAM
34 * \param b pointer to string in Flash
35 * \return index of the first char where \c a and \c b differ
37 uint32_t stridentcnt(const char* a, const char* b);
39 /** \fn firstword_length(char* s)
40 * \brief compute the length of the first word in supplied string
42 * This function searches for the first whitespace in the string and returns the
43 * number of chars before the first whitespace.
45 * \return number of chars in first word
47 uint16_t firstword_length(const char* s);
49 /** \fn strstrip(char* str)
50 * \brief removes whitespace at the beginning and the end of a string
52 * This function removes whitespaces at the end of a string.
54 * \return pointer to the first non-whitespace char in string
56 char* strstrip(char* str);
58 void str_reverse(char* buffer);
60 char* ultoa(unsigned long a, char* buffer, uint8_t radix);
62 char* ulltoa(unsigned long long a, char* buffer, uint8_t radix);
64 char* ustoa(unsigned long a, char* buffer, uint8_t radix);
65 // void strlwr(char* s);