| 731 | typename alloc |
| 732 | > |
| 733 | const std::basic_string<charT,traits,alloc> lpad ( |
| 734 | const std::basic_string<charT,traits,alloc>& str, |
| 735 | long pad_length, |
| 736 | const std::basic_string<charT,traits,alloc>& pad_string |
| 737 | ) |
| 738 | { |
| 739 | typedef std::basic_string<charT,traits,alloc> string; |
| 740 | // if str is too big then just return str |
| 741 | if (pad_length <= static_cast<long>(str.size())) |
| 742 | return str; |
| 743 | |
| 744 | // make the string we will padd onto the string |
| 745 | string P; |
| 746 | while (P.size() < pad_length - str.size()) |
| 747 | P += pad_string; |
| 748 | P = P.substr(0,pad_length - str.size()); |
| 749 | |
| 750 | // return the padded string |
| 751 | return P + str; |
| 752 | } |
| 753 | |
| 754 | template < |
| 755 | typename charT, |