CoNLL-U
Loading...
Searching...
No Matches
string.hpp
1/*
2 * CoNLL-U - https://github.com/tugrulgungor/CoNLL-U
3 *
4 * Copyright (c) 2026. All rights reserved.
5 * Tuğrul Güngör - https://conll-u.tugrulgungor.me
6 *
7 * Distributed under the MIT License.
8 * https://opensource.org/license/mit/
9 */
10
11#ifndef TG_CONLLU_INTERNAL_STRING_HPP
12#define TG_CONLLU_INTERNAL_STRING_HPP 1
13
14#include <charconv>
15#include <string_view>
16
17namespace tg::conllu::internal {
18 template <char C = ' '>
19 constexpr void trim_start(std::string_view &str) noexcept;
20 template <char C = ' '>
21 constexpr void trim_end(std::string_view &str) noexcept;
22 template <char C = ' '>
23 constexpr void trim(std::string_view &str) noexcept;
24
25 template <typename NumberType>
26 requires std::is_integral_v<NumberType>
27 [[nodiscard]] constexpr bool parse_number(std::string_view str, NumberType &number) noexcept;
28
29 template <char Delimiter, bool Strict>
30 [[nodiscard]] constexpr bool split(std::string_view str, std::string_view &first,
31 std::string_view &second) noexcept;
32
33 template <char Delimiter, typename NumberType>
34 requires std::is_integral_v<NumberType> && std::is_unsigned_v<NumberType>
35 [[nodiscard]] constexpr bool split_and_parse(std::string_view str, NumberType &first, NumberType &second) noexcept;
36} // namespace tg::conllu::internal
37
38#include "conllu/internal/impl/string.ipp"
39
40#endif // TG_CONLLU_INTERNAL_STRING_HPP