From the System Expressions page of the C2 manual:
len(text) [can be used to do your button 2]
Return the number of characters in text.
mid(text, index, count) [can be used to do your button 3]
Return the count characters starting from index in text.
For button 1, you could separate your lines with a special character and then use that as a marker to split each line into tokens and count the tokens. For example you could format it as "HELLO\BYE" and do this: tokencount("HELLO\BYE", "\")