1.9 Records
Consider this one-sentence paragraph with some text formatted in bold and italics:
Some words are bold, some are italic, and some are both.
How could you represent this as data in a word processor, spreadsheet, or presentation application?
Let’s begin with the text itself for the paragraph. Maybe we just use a string.
"Some words are bold, some are italic, and some are both."
The words are there, but we lost the formatting. Let’s break the sentence
into a list of the formatted and unformatted parts. I use square brackets “[ ]
” around the list and commas to separate the parts.
[ "Some words are ",
"bold",
",some are ",
"italic",
", and some are ",
"both",
"." ]
Now we can focus on how to embellish each part with formatting. There are four options:
- the text...