【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.2.65 str_pad_char
Contents
Description
pad a string with given charactor.
Syntax
string str_pad_char( LPCSTR lpcstr, int nTotalLength, int nPaddingFormat, char chPading = ' ' )
Parameters
- lpcstr
- [input] the string to be padded
- nTotalLength
- [input] sepecify the length of the string after padding.
- nPaddingFormat
- [input] sepecify the famat of padding.
- 0: padding by the end
- 1: padding both by the end and the head
- 2: padding by the head
- chPading
- [input] charactor to pad.
Return
a string padded from lpcstr with chPading.
Examples
EX1
void str_pad_char_ex1() { LPCSTR lpcstr = "Dollars"; int nTotalLength = 30; int nPaddingFormat = 0; char chPading = '$'; string strResult; strResult = str_pad_char(lpcstr, nTotalLength, nPaddingFormat, chPading); printf("%s\n",strResult); }
Remark
See Also
Header to Include
origin.h