C++C++14C++17C++20Learn C++Syntax

What Is std::quoted Quoted String In Modern C++?

What Is stdquoted Quoted String In Modern C++

Sometimes we want to preserve the string format especially when we use string in a string with /”. In C++14 and above, there is a std::quoted template that allows handling strings safely where they may contain spaces and special characters and it keeps their formatting intact. In this post, we explain std::quoted quoted strings in modern C++.

What Is Quoted String In Modern C++?

The std::quoted template is included in <iomanip> header, and it is used to handle strings (i.e. “Let’s learn from \”LearnCPlusPlus.org!\” “) safely where they may contain spaces and special characters and it keeps their formatting intact. 

Here is the syntax,

Here are C++14 templates defined in <iomanip> where the string is used as input,

or

Here is a C++14 template defined in <iomanip> where the string is used as output,

Note that this feature is is using std::basic_string and it improved in C++17 by the  std::basic_string_view support.

What Is std::quoted quoted string in modern C++?

Here is an example that uses input string and outputs into a stringstream:

Here is an example that uses stringstream as an input and outputs into a string.

Is there a full example about std::quoted quoted string in modern C++?

Here is a full example about std::quoted in modern C++.

For more information about this feature, please see https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3654.html

What Is stdquoted Quoted String In Modern C++ The C++ Builder Logo

C++ Builder is the easiest and fastest C and C++ IDE for building powerful, good-looking applications. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs.

There is a free C++ Builder Community Edition for students, beginners, and startups; it can be downloaded from here. For professional developers, there are Professional, Architect, or Enterprise versions of C++ Builder and there is a trial version you can download from here

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial

Free C++Builder Community Edition

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++17Language FeatureLearn C++

How To Use The SVG Image Format With Skia In C++ Builder

C++C++17Language FeatureLearn C++

How To Use Skia Images in C++ Builder?

C++C++17Code SnippetGame DevelopmentLanguage FeatureLearn C++

What Is Skia In Modern C++?

C++C++17Learn C++

How To Use Skia in C++ Builder 12?