Skip to main content

Working with Text

  • Chapter
  • First Online:
  • 1955 Accesses

Abstract

Working with text will be one of the most regular tasks a C++ programmer will have to deal with. You are likely to need to read in user input, write out messages to the user, or write logging functionality for other programmers to more easily debug running programs. Unfortunately, working with text is not an easy or straightforward task. All too often, programmers rush into the job and make fundamental errors with their text handling which become major issues later into their projects. The worst of these is not properly accounting for localized versions of text strings. Working with English character sets is generally easy as all English characters and punctuation fit into the ASCII character set. This is convenient as every character needed to represent the English language can fit into a single 8-bit char variable. Things become problematic as soon as you are required to support foreign languages with your programs. Every character which you need to support will no longer fit into a single 8-bit value. C++ can handle non-English languages in a number of ways which will be covered in this chapter.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2020 J. Burton Browning and Bruce Sutherland

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Browning, J.B., Sutherland, B. (2020). Working with Text. In: C++20 Recipes. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-5713-5_3

Download citation

Publish with us

Policies and ethics