aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/stream_executor/lib/str_util.h
blob: 021f54dfeca7fe4ba437311d81beb79f02ffb12a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef TENSORFLOW_STREAM_EXECUTOR_LIB_STR_UTIL_H_
#define TENSORFLOW_STREAM_EXECUTOR_LIB_STR_UTIL_H_

#include "tensorflow/core/lib/strings/str_util.h"
#include "tensorflow/stream_executor/lib/stringpiece.h"

namespace perftools {
namespace gputools {
namespace port {

using tensorflow::str_util::Join;
using tensorflow::str_util::Split;

// Returns a copy of the input string 'str' with the given 'suffix'
// removed. If the suffix doesn't match, returns a copy of the original string.
inline string StripSuffixString(port::StringPiece str, port::StringPiece suffix) {
  if (str.ends_with(suffix)) {
    str.remove_suffix(suffix.size());
  }
  return str.ToString();
}

using tensorflow::str_util::Lowercase;
using tensorflow::str_util::Uppercase;

}  // namespace port
}  // namespace gputools
}  // namespace perftools

#endif  // TENSORFLOW_STREAM_EXECUTOR_LIB_STR_UTIL_H_