Cold Help System: Programming: ColdC Reference Manual: Functions: String: pad()


STRING pad(STRING str, INTEGER length[, STRING filler])

This function pads or truncates the argument string to the length given with the argument length. If the argument filler is specified, then it is used to pad the string, otherwise a space is used. If length is greater than the length of string, then pad adds filler characters on the right. If the length is a negative amount, filler will be added on the left instead. The function strfmt() may also be used for string padding. Examples:

pad("foo", 6)
=> "foo "
pad("foobar", 3)
=> "foo"
pad(tostr(29), -4, "0")
=> "0029"
pad("what", 20, "!?!")
=> "what!?!!?!!?!!?!!?!!"


crypt() | explode() | lowercase() | match_begin() | match_pattern() | match_regexp() | match_template() | pad() | regexp() | strcmp() | strfmt() | strgraft() | strlen() | strsed() | strsub() | substr() | uppercase() | match_crypted() | split() | stridx()


the Cold Dark