11 Working with strings

 

This chapter covers

  • Understanding the relationships between Unicode, code points, and UTF-8 encoding
  • Comparing strings, converting them to lowercase, and performing other string operations
  • When and how to use raw strings
  • Learning about different kinds of string literals, including regular expressions, MIME types, and BigInt literals

You’ve already had some hands-on experience working with strings in earlier chapters; however, I’ll cover many more details that will help you correctly use text strings in this chapter. In this chapter you will examine these details more closely. As long as you are working with the letters A-Z, things will be simple. However, there are a multitude of languages in the world with their own unique set of characters that Julia needs to be able to deal with.

That means the minimal required knowledge for working effectively with Julia strings includes some knowledge of Unicode. Unicode is the international standard for mapping numbers (code points) to characters.

Julia also has support for special string literals to aid in performing a variety of tasks. For example, there are special strings called regular expressions that allow you to check whether another string matches a particular pattern, such as an email address, IP address, or zip code.

11.1 UTF-8 and Unicode

11.1.1 Understanding the relation between code points and code units

11.2 String operations

11.2.1 Converting from camel case to snake case

11.2.2 Converting between numbers and strings

11.2.3 String interpolation and concatenation

11.2.4 sprintf formatting

11.3 Using string interpolation to generate code

11.4 Working with nonstandard string literals

11.4.1 DateFormat strings

11.4.2 Raw strings

11.4.3 Using regular expressions to match text