- Modern C++ Programming Cookbook
- Marius Bancila
- 202字
- 2021-06-11 18:22:15
2 Working with Numbers and Strings
Numbers and strings are the fundamental types of any programming language; all other types are based on or composed of these ones. Developers are confronted all the time with tasks such as converting between numbers and strings, parsing and formatting strings, and generating random numbers. This chapter is focused on providing useful recipes for these common tasks using modern C++ language and library features.
The recipes included in this chapter are as follows:
- Converting between numeric and string types
- Limits and other properties of numeric types
- Generating pseudo-random numbers
- Initializing all the bits of the internal state of a pseudo-random number generator
- Creating cooked user-defined literals
- Creating raw, user-defined literals
- Using raw string literals to avoid escaping characters
- Creating a library of string helpers
- Verifying the format of a string using regular expressions
- Parsing the content of a string using regular expressions
- Replacing the content of a string using regular expressions
- Using std::string_view instead of constant string references
- Formatting text with std::format
- Using std::format with user-defined types
Let's start this chapter by looking at a very common problem developers face on a daily basis, which is converting between numeric and string types.
推薦閱讀
- Facebook Application Development with Graph API Cookbook
- 劍指JVM:虛擬機實踐與性能調優
- jQuery EasyUI網站開發實戰
- SQL for Data Analytics
- 深入理解Java7:核心技術與最佳實踐
- Web Application Development with MEAN
- Java Web基礎與實例教程
- Banana Pi Cookbook
- MySQL從入門到精通(軟件開發視頻大講堂)
- Java面向對象程序設計
- Learning AWS
- Azure Serverless Computing Cookbook
- MINECRAFT編程:使用Python語言玩轉我的世界
- Android嵌入式系統程序開發:基于Cortex-A8(第2版)
- Managing Microsoft Hybrid Clouds