Salad  1.0.15
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
string.h
Go to the documentation of this file.
1 /*
2  * Salad - An assortment of useful C stuff
3  * Copyright (C) 2016 Lloyd Dilley
4  * http://www.dilley.me/
5  *
6  * This file is part of Salad.
7  *
8  * Salad is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version
11  * 3 of the License, or (at your option) any later version.
12  *
13  * Salad is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with Salad. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef STRING_H
23 #define STRING_H
24 
25 #include "salad/types.h"
26 
48 char *sld_string_allocate(char *string);
49 
63 char *sld_string_chomp(char *string);
64 
82 char *sld_string_chop(char *string);
83 
97 char *sld_string_trim_leading(char *string);
98 
112 char *sld_string_trim_trailing(char *string);
113 
127 char *sld_string_trim(char *string);
128 
140 SLD_BOOL sld_string_contains_character(char *string, char character);
141 
155 char *sld_string_capitalize(char *string);
156 
170 char *sld_string_uncapitalize(char *string);
171 
187 SLD_BOOL sld_string_casecmp(char *string1, char *string2);
188 
206 char *sld_string_multiply(char *string, int factor, char separator);
207 
221 char *sld_string_reverse(char *string);
222 
225 #endif /* STRING_H */
char * sld_string_uncapitalize(char *string)
Uncapitalizes the specified string.
Definition: string.c:174
char * sld_string_trim_trailing(char *string)
Removes trailing whitespace from the passed string.
Definition: string.c:112
char * sld_string_reverse(char *string)
Reverses the passed string.
Definition: string.c:237
char * sld_string_allocate(char *string)
Allocates enough memory to store the specified string. You can then call strcpy() using the returned ...
Definition: string.c:34
char * sld_string_chomp(char *string)
Removes trailing &quot;\r\n&quot; characters on a passed string.
Definition: string.c:53
char * sld_string_trim_leading(char *string)
Removes leading whitespace from the passed string.
Definition: string.c:99
char * sld_string_chop(char *string)
Removes trailing &quot;\r\n&quot; characters on a passed string or the last character if &quot;\r\n&quot; does not exist...
Definition: string.c:78
SLD_BOOL sld_string_casecmp(char *string1, char *string2)
Compares two strings for equality regardless of capitalization.
Definition: string.c:190
SLD_BOOL sld_string_contains_character(char *string, char character)
Checks whether or not a string contains a specified character.
Definition: string.c:141
SLD_USINT SLD_BOOL
Definition: types.h:65
char * sld_string_capitalize(char *string)
Capitalizes the specified string.
Definition: string.c:158
char * sld_string_trim(char *string)
Removes leading and trailing whitespace from the passed string.
Definition: string.c:128
char * sld_string_multiply(char *string, int factor, char separator)
Multiplies a passed string by the specified factor and separated by the specified character...
Definition: string.c:202