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