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 8640767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:21:34+00:00 2026-06-12T11:21:34+00:00

I saw some questions here related to removing double quotes. But it not solved

  • 0

I saw some questions here related to removing double quotes. But it not solved my Issue. They told to use Replace or Trim functions. I used but the problem remains.

My code:

DataTable dt = TypeConveriontHelper.ConvretExcelToDataTable(SourceAppFilePath);
        string targetPath = BatchFolderPath + @"\" + "TRANSACT.INX";
        StreamWriter wrtr = null;
        wrtr = new StreamWriter(targetPath);
        for (int x = 0; x < dt.Rows.Count; x++)
        {
            string rowString = "";
            for (int y = 0; y < dt.Columns.Count; y++)
            {
                if (y == dt.Columns.Count - 1)
                {
                    rowString += "\"" + dt.Rows[x][y].ToString() + "\"";
                }
                else
                {
                    rowString += "\"" + dt.Rows[x][y].ToString() + "\"~";
                }
            }           
            rowString.Replace('"', ' ').Trim();
            wrtr.WriteLine(rowString);
        }
        wrtr.Close();
        wrtr.Dispose();

I tried by using rowString.Replace('"', ' ').Trim(); in above code. But double quotes are present as it is. Proveide me a solution. Thanks.

  • 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-12T11:21:36+00:00Added an answer on June 12, 2026 at 11:21 am

    You need to assign it back to rowString:

    rowString = rowString.Replace('"', ' ').Trim();
    

    Strings are immutable.

    row.String.Replace(...) will return you a string, since you are not assigning it anything it will get discarded. It will not change the original rowString object.

    You may use String.Empty or "" to replace double quotes with an empty string, instead of single space ' '. So your statement should be:

    rowString = rowString.Replace("\"", string.Empty).Trim();
    

    (Remember to pass double quote as a string "\"", since the method overload with string.Empty will require both the parameters to be of type string).

    You may get rid of Trim() at the end, if you were trying to remove spaces adding during string.Replace at the beginning or end of the string.

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

Sidebar

Related Questions

I saw some questions ( Here and Here ) but they do not answer
I saw some other similar questions on this topic here but they were not
I saw some related questions on SO, but I'm not able to resolve my
I've already saw some questions here at stackoverflow but none of them has solved
I know that some similar questions has been asked here, but I saw all
I saw some code when studying the open source project: here . But I
I saw similar questions here, but I couldn't find solution to my problem. I
I saw many similar questions here but their answers don't work for me by
i know this is an old issue and i saw many questions related to
I saw some similar questions to this but none seems to address this is

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.