Users who have difficulty reading perhaps because

Info icon This preview shows pages 339–341. Sign up to view the full content.

View Full Document Right Arrow Icon
Users who have difficulty reading (perhaps because they have a low-vision condition) may have that text transformed into sound by accessibility tools, but the application is still processing text strings under the covers. Even when we are dealing with integers or doubles internally within an algorithm, there comes a time when we need to represent them to humans, and preferably in a way that is meaningful to us. We usually do that (at least in part) by converting them into strings of one form or another. Strings are surprisingly complex and sophisticated entities, so we’re going to take some time to explore their properties in this chapter. First, we’ll look at what we’re really doing when we initialize a literal string. Then, we’ll see a couple of techniques which let us convert from other types to a string represen- tation and how we can control the formatting of that conversion. Next, we’ll look at various different techniques we can use to process a string. This will include composition, splitting, searching and replacing content, and what it means to compare strings of various kinds. Finally, we will look at how .NET represents strings internally, how that differs from other representations in popular use in the world, and how we can convert between those representations by using an Encoding . 315
Image of page 339

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
What Is a String? A string is an ordered sequence of characters: We could consider this sentence to be a string. We start with the first character, which is W . Then we continue on in order from left to right: 'W', 'e', ' ', 'c', 'o', 'u', 'l', 'd' And so on. A string doesn’t have to be a whole sentence, of course, or even anything meaningful. Any ordered sequence of characters is a string. Notice that each character might be an uppercase letter, lowercase letter, space, punctuation mark, number (or, in fact, any other textual symbol). It doesn’t even have to be an English letter. It could be Arabic, for example: ΔϴΑήόϟ΍ Here we have the following characters: ' Γ ' ,' ϱ ' ,' Ώ ' ,' έ ' ,' ω ' ,' ϝ ' ,' ΍ ' If you look carefully, you’ll notice that the string is ordered the other way round—the first character is the rightmost one, and the last character is the leftmost one. This is because Arabic scripts read right to left and not left to right; but the string is still ordered, character by character. A quick reminder: a font is a particular visual design for an entire set of characters. Historically, it was a box containing a set of moveable type in a specific design at a certain size, but we’ve come to blur the meanings of font family, typeface, and font in popular usage, and people tend to use these terms interchangeably now. I think it is interesting to note that only a few years ago, fonts were the sole purview of designers and printers; but they’ve now become com- monplace, thanks to the ubiquity of the word processor.
Image of page 340
Image of page 341
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern