lpad.cc
Go to the documentation of this file.
1 // ======================================================================
2 //
3 // lpad: Left-pad a string to the wanted size, unless already longer
4 //
5 // ======================================================================
6 
7 #include "cetlib/lpad.h"
8 
11  std::string::size_type wanted_size,
12  char char_to_pad_with)
13 {
14  if (wanted_size <= s.size())
15  return s; // already long enough
16 
17  std::string result(wanted_size - s.size(), char_to_pad_with);
18  return result.append(s);
19 
20 } // lpad()
21 
22 // ======================================================================
static QCString result
std::string string
Definition: nybbler.cc:12
std::string lpad(std::string const &pad_me, std::string::size_type wanted_size, char char_to_pad_with= ' ')
Definition: lpad.cc:10
static QCString * s
Definition: config.cpp:1042
QCString & append(const char *s)
Definition: qcstring.cpp:383