Caffe2 - C++ API
A deep learning, cross platform ML framework
string_utils.h
1 #pragma once
2 
3 #include <algorithm>
4 #include <memory>
5 #include <string>
6 #include <vector>
7 
8 #include "caffe2/core/common.h"
9 
10 namespace caffe2 {
11 
12 CAFFE2_API std::vector<std::string> split(char separator, const std::string& string);
13 
14 CAFFE2_API std::string trim(const std::string& str);
15 
16 CAFFE2_API size_t editDistance(
17  const std::string& s1, const std::string& s2, size_t max_distance = 0);
18 
19 CAFFE2_API inline bool StartsWith(const std::string& str, const std::string& prefix) {
20  return std::mismatch(prefix.begin(), prefix.end(), str.begin()).first ==
21  prefix.end();
22 }
23 
24 CAFFE2_API inline bool EndsWith(
25  const std::string& full,
26  const std::string& ending) {
27  if (full.length() >= ending.length()) {
28  return (
29  0 ==
30  full.compare(full.length() - ending.length(), ending.length(), ending));
31  } else {
32  return false;
33  }
34 }
35 
36 CAFFE2_API int32_t editDistanceHelper(const char* s1,
37  size_t s1_len,
38  const char* s2,
39  size_t s2_len,
40  std::vector<size_t> &current,
41  std::vector<size_t> &previous,
42  std::vector<size_t> &previous1,
43  size_t max_distance);
44 } // namespace caffe2
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13