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
27 /** \fn stridentcnt_P(char* a, PGM_P b)
28 * \brief counts the number of identic chars
30 * This function compares the supplyed strings and returns the index of the
31 * first char where the strings differ.
32 * \param a pointer to string in RAM
33 * \param b pointer to string in Flash
34 * \return index of the first char where \c a and \c b differ
36 uint16_t stridentcnt_P(char* a, PGM_P b);
38 /** \fn firstword_length(char* s)
39 * \brief compute the length of the first word in supllyed string
41 * This function searches for the first whitespace in the string and returns the
42 * number of chars before the first whitespace.
44 * \return number of chars in first word
46 uint16_t firstword_length(char* s);
48 /** \fn strstrip(char* str)
49 * \brief removes whitespace at the beginning and the end of a string
51 * This function removes whitespaces at the end of a string.
53 * \return pointer to the first non-whitespace char in string
55 char* strstrip(char* str);