| 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, |