January 2019
Intermediate to advanced
246 pages
5h 23m
English
Your inputs have arrived as strings, and most kinds of data can be represented as strings. Working with strings is the bread and butter of every programmer. Like Ruby, Crystal is well equipped for string processing. You’ve been using strings throughout this book, but there are more ways to create strings and more ways to work with them.
Crystal, like Ruby, supports multi-line strings:
| | str = "What a beautiful mineral!" |
| | str1 = "What a |
| | beautiful mineral!" # multi-line string |
Crystal also supports the use of the backslash to escape characters inside of strings. If you wanted to create the same str1 shown above while keeping it on one line in your code, you could instead type the following:
| | str = "What a beautiful ... |
Read now
Unlock full access