blob: 5b47b9b872e4c85714186f0c89b974e0009a4074 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/*
Copyright 2015 Ian Jauslin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
String manipulation
*/
#ifndef ISTRING_H
#define ISTRING_H
// concatenate str at the position pointed to by ptr, and return a pointer
// to the end of the new string
char* str_concat(char* ptr, const char* str);
// concatenate strings and resize them if necessary
int str_concat_memorysafe(char** str_out, int pos, const char* str, int* memory);
// resize a string
int resize_str(char** out, int memory);
// idem with a single character
char* str_addchar(char* ptr, const char c);
// string length
int str_len(char* str);
// compare strings
int str_cmp(char* str1, char* str2);
// copy a string to another without allocating memory
int str_cpy_noalloc(char* input, char* output);
#endif
|