MCPcopy Create free account
hub / github.com/davisking/dlib / rpad

Function rpad

dlib/string/string.h:689–708  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

687 typename alloc
688 >
689 const std::basic_string<charT,traits,alloc> rpad (
690 const std::basic_string<charT,traits,alloc>& str,
691 long pad_length,
692 const std::basic_string<charT,traits,alloc>& pad_string
693 )
694 {
695 typedef std::basic_string<charT,traits,alloc> string;
696 // if str is too big then just return str
697 if (pad_length <= static_cast<long>(str.size()))
698 return str;
699
700 // make the string we will padd onto the string
701 string P;
702 while (P.size() < pad_length - str.size())
703 P += pad_string;
704 P = P.substr(0,pad_length - str.size());
705
706 // return the padded string
707 return str + P;
708 }
709
710 template <
711 typename charT,

Callers 5

string_testFunction · 0.85
padFunction · 0.85
trainMethod · 0.85
mainFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by 1

string_testFunction · 0.68