Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7093583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:27:27+00:00 2026-05-28T08:27:27+00:00

Is there a way in C++ to quote a string without having to escape

  • 0

Is there a way in C++ to quote a string without having to escape with backslashes? For example, I would like a way to store some Latex code in a string, such as \documentclass{article}. I could do

string latex_code = "\\documentclass{article}"

But that gets annoying when you have to escape a lot of things, for example if you have a lot of Latex code. In Perl, I remember that you have some very useful quoting tools. See, for example, the “q” and “qq” sections here:
http://www.perlmonks.org/?node_id=401006

Is there something similar in C++? The only other thing I can think of is to paste the Latex code into an external file and read it in. But that also seems annoying.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:27:28+00:00Added an answer on May 28, 2026 at 8:27 am

    C++11 has a way:

    R"(The String Data \ Stuff " )"
    R"delimiter(The String Data \ Stuff " )delimiter"
    

    In the first case, everything between the “( and the )” is part of the string. The ” and \ characters do not need to be escaped. In the second case, the “delimiter( starts the string, and it only ends when )delimiter” is reached. The string delimiter can be any string up to 16 characters in length, including the empty string. This string cannot contain spaces, control characters, ‘(‘, ‘)’, or the ‘\’ character. The use of this delimiter string allows the user to have “)” characters within raw string literals. For example, R”delimiter((a-z))delimiter” is equivalent to “(a-z)”

    http://en.wikipedia.org/wiki/C%2B%2B11

    It’s not possible in C++03.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to assign a multiline string value in Delphi without having
In C#, if you want to read a string without having to escape the
Is there way in next piece of code to only get the first record?
is there way how to get name ov event from Lambda expression like with
I would like to have this piece of code in my .aspx file: <input
Is there any way I can insert an HTML template to existing DOMNode without
Is there any way in JavaScript to create a "weak reference" to another object?
Are DES Encryption called "One Way Encryption" or "two way Encryption" ? Are there
Premise I believe that there is a way to objectively define "Good" and "Bad"
There's a fairly easy way of retrieving 15-minute delayed quotes off of Yahoo! Finance

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.