Gyoji Compiler
Loading...
Searching...
No Matches
jstring.hpp
1/* Copyright 2025 Jonathan S. Arney
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * https://github.com/jarney/gyoji/blob/master/LICENSE
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#pragma once
16
17#include <string>
18#include <vector>
19
20namespace Gyoji::misc {
21
22 std::vector<std::string> string_split(const std::string &str, const std::string &delimiter);
23
24 bool startswith(const std::string & s, const std::string & prefix);
25 bool endswith(const std::string & s, const std::string & suffix);
26 std::string join(const std::vector<std::string> & list, std::string delimiter);
27 std::string join_nonempty(const std::string &a, const std::string & b, std::string delimiter);
28
29 std::string string_remove(const std::string & str, const std::string & remove);
30
31 std::string string_replace_start(std::string str, const std::string from, const std::string to);
32
33 bool string_c_escape(std::string & escaped_string, const std::string & unescaped_string, bool is_char);
34
42 bool string_c_unescape(std::string & unescaped_string, size_t & location, const std::string & escaped_string, bool is_char);
43
44
45};