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

  • Home
  • SEARCH
  • 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 8790623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:42:23+00:00 2026-06-13T22:42:23+00:00

I am attempting to do some string manipulations and I have a need to

  • 0

I am attempting to do some string manipulations and I have a need to take multi-line strings and create a List<String> by splitting on \r\n so that I end up with a list of the lines found in the string.

However, after doing the Regex.Split I’m ending up with lines that have every single

" escaped with a \.

For example, a snippet of an input string is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<g2s:g2sMessage xmlns:g2s="http://www.gamingstandards.com/g2s/schemas/v1.0.3">
   <g2s:g2sBody g2s:dateTimeSent="2012-11-06T09:12:38.006-08:00" g2s:egmId="RBG_1234"
                g2s:hostId="1">
      <g2s:communications g2s:commandId="37102" g2s:dateTime="2012-11-06T09:12:38.004-08:00"
                          g2s:deviceId="1"
                          g2s:errorCode="G2S_none"

When I do the following to split this string into a List<String> using:

List<string> lines = new List<string>(Regex.Split(message, "\r\n"));

The result is:

<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
<g2s:g2sMessage xmlns:g2s=\"http://www.gamingstandards.com/g2s/schemas/v1.0.3\">
   <g2s:g2sBody g2s:dateTimeSent=\"2012-11-06T09:12:38.006-08:00\" g2s:egmId=\"RBG_1234\"
            g2s:hostId=\"1\">
      <g2s:communications g2s:commandId=\"37102\" g2s:dateTime=\"2012-11-06T09:12:38.004-08:00\"
            g2s:deviceId=\"1\"
            g2s:errorCode=\"G2S_none\"

How would I do this without ending up with strings that have " escaped?
Is C# really escaping the characters, or is it just the way the debugger is showing the strings?

  • 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-06-13T22:42:24+00:00Added an answer on June 13, 2026 at 10:42 pm

    This is just the way that the string is displayed inside the debugger (Visual Studio, I guess?). Those backslashes aren’t really in your string. You can prove this to yourself by outputting the string to the console or to a file, and noticing that the backslashes don’t appear.

    visual studio

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

Sidebar

Related Questions

Im attempting to take a string that is in a partial comma separated setup.
I am attempting to remove some line breaks and spaces from a multiline string
I have some code where I'm attempting to create a temporary file to be
I have some code written that is attempting to connect to a mysql db.
I am attempting to add some multi-threading to a WPF application I have created
I am attempting to compile some code, but am running into some problems that
I'm attempting to pull some data from a SQLite database so that I can
I'm attempting to build some C++ code that requires the Windows 7.0 SDK header
I am attempting to do some dynamic loading that includes javascript, css, and html
I'm attempting to create an order number for customers to use. I will have

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.