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