Messaging the length of character strings
Exercise Type: Implementation
Instructions
Step 1
Make a variable called text
that stores a character string, for instance, this:
"This is a string!"
Step 2
Use a combination of paste()
, nchar()
and message()
to display how many characters the string stored in text
has using this format:
Your string 'This is a string!' contains 17 characters!
Note that 17 needs to be calculated from the string that you entered and not hard-coded in your program!
Step 3
Make sure to try it with another string!