/* Copyright 2015-2022 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