string_pad [function]
string_pad( string str, int tgtsize, string padstr = " ", int flags = STRING_PAD_RIGHT )
return the string str, padded from template padstr up to the size tgtsize according to flags
- if
str is longer than tgtsize, it is returned without changes
- available values for
flags:
STRING_PAD_LEFT - pad the string at the left side
STRING_PAD_RIGHT - pad the string at the right side
- if both flags are OR'ed together, the string
str is centered
- at least one of the flags must be specified if the argument is passed for the function to work
string_pad( "padded", 10 ); // string [10] "padded "
string_pad( "center", 10, "_", STRING_PAD_LEFT | STRING_PAD_RIGHT ); // string [10] "__center__"