I can't quite figure out how to pad a message that I send. Basically.. I want to pad the message to the max 512 chars as defined in the RFC.
I understand that a message being sent by the user will contain user!user@hostname privmsg #chan (or other_user): text text text \r\n.
Thanks in advance.
To pad a string you can use the functions
ljust
,center
orrjust
, respectively:Output (Try it):
All three functions have an optional second argument
fillchar
which lets you specify the character that is used to fill up the additional space.