tlx
pad.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * tlx/string/pad.cpp
3  *
4  * Part of tlx - http://panthema.net/tlx
5  *
6  * Copyright (C) 2007-2017 Timo Bingmann <tb@panthema.net>
7  *
8  * All rights reserved. Published under the Boost Software License, Version 1.0
9  ******************************************************************************/
10 
11 #include <tlx/string/pad.hpp>
12 
13 namespace tlx {
14 
15 std::string pad(const std::string& s, size_t len, char pad_char) {
16  std::string str = s;
17  str.resize(len, pad_char);
18  return str;
19 }
20 
21 } // namespace tlx
22 
23 /******************************************************************************/
std::string pad(const std::string &s, size_t len, char pad_char)
Truncate or pad string to exactly len characters.
Definition: pad.cpp:15