cpp-common
test_string.cc
Go to the documentation of this file.
1 // -*- mode: c++; c-basic-offset: 2; -*-
2 
9 #include <cstdlib>
10 #include <iostream>
11 
12 #include "gtest/gtest.h"
13 #include "nvsl/string.hh"
14 
15 TEST(string, split) {
16  const std::string test_str = "Hello! World.";
17  const auto toks = nvsl::split(test_str, " ");
18 
19  EXPECT_TRUE(toks[0] == "Hello!");
20  EXPECT_TRUE(toks[1] == "World.");
21 
22 }
nvsl::split
auto split(const std::string &str, const std::string &delim, size_t assert_length=UINT64_MAX)
Split string using a delimeter into a vector of strings.
Definition: string.hh:17
string.hh
Usefult string functions. Mostly resemble python's.