10STRING DATA TYPES

image

After integers, character strings are probably the most commonly used data type in modern programs; after arrays, they’re the second most commonly used composite data type. A string is a sequence of objects. Most often, the term string describes a sequence of character values, but it’s also possible to have strings of integers, real values, Boolean values, and so on (for example, I’ve already discussed bit strings in this book and in WGC1). In this chapter, though, we’ll stick to character strings.

In general, a character string possesses two main attributes: a length and some character data. Character strings can also possess ...

Get Write Great Code, Volume 2, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.