TCL Substring, How do you do it?

At first I was a bit confused on how to achieve a substring in TCL. Its not very clear and its not well documented, but in the end I found it.

Here is it:

set string "This is an example string"
putserv "PRIVMSG #channel :Example: [string range $string 0 4]"
# This would message #channel with "Example: This"
# Remember: All strings start at letter number 0.

Hope this helps.

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)