September 2001
Intermediate to advanced
768 pages
32h 45m
English
string str_pad(string string, int length, [string pad_string] [int pad_end])
| string | String to be padded |
| length | Desired string length |
| pad_string | String to use for padding |
| pad_end | Flag that controls whether right, left, or both ends of the string are padded |
Pads a string with arbitrary characters.
Returns:
String; NULL on error
Description:
str_pad() is used to pad a string to length length using the characters in pad_string . If pad_string is not specified, spaces are used.
When more than one character is used for pad_string , the padding is generated by repeating the pad_string from left to right until the desired length is reached. Any extra characters are truncated.
If the amount of padding specified is less than the length ...
Read now
Unlock full access