Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
string.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#pragma once
9
10#include <string>
11#include <string_view>
12#include <vector>
13
14namespace momentum {
15
29template <typename StringType>
30[[nodiscard]] StringType trim(const StringType& text, const char* whiteChars = " \t");
31
42[[nodiscard]] std::string trim(const char* text, const char* whiteChars = " \t");
43
61std::vector<std::string> tokenize(
62 const std::string& inputString,
63 const std::string& delimiters = " \t\r\n",
64 bool trim = true);
65
79std::vector<std::string_view>
80tokenize(std::string_view inputString, std::string_view delimiters = " \t\r\n", bool trim = true);
81
82} // namespace momentum
StringType trim(const StringType &text, const char *whiteChars)
Returns a copy of the string with leading and trailing characters in whiteChars removed.
Definition string.cpp:16
std::vector< std::string > tokenize(const std::string &inputString, const std::string &delimiters, const bool trim)
Tokenizes a string using the specified single-byte delimiter characters.
Definition string.cpp:42