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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:45:28+00:00 2026-06-04T20:45:28+00:00

I need to replace the characters ; and linebreak to the field p.notas .

  • 0

I need to replace the characters ; and linebreak to the field p.notas. I tried this but it doesn’t replace the linebreaks.

var res = from p in miDataContext.clientes
          orderby p.nombreCom
          select                             
              (p.nombreCom ?? "") + ";" +
              (p.razon ?? "") + ";" +
              (p.nif ?? "") + ";" +                                 
              ((p.notas ?? "").Replace (";" ,"."))
                  .Replace(Environment.NewLine , ". ");
  • 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-04T20:45:30+00:00Added an answer on June 4, 2026 at 8:45 pm

    The problem with using Environment.NewLine in your Replace() call is that the newline character(s) in your environment my not necessarily match what is actually used in the string. Yours probably has \r\n (windows) but what is actually stored is just \n. That pattern is definitely not in the string in that case. You’ll have to check for all newline variants.

    Assuming this is all fine in LINQ to SQL, just add more replace calls for each of the newline types.

    var res = from p in miDataContext.clientes
              orderby p.nombreCom
              select
                  (p.nombreCom ?? "") + ";" +
                  (p.razon ?? "") + ";" +
                  (p.nif ?? "") + ";" +                                 
                  ((p.notas ?? "").Replace(";", "."))
                      .Replace("\r\n", ". ")
                      .Replace("\n", ". ")
                      .Replace("\r", ". ");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to replace special characters from a string, like this: this.value = this.value.replace(/\n/g,'');
I have a string. In this string i need replace all special characters (0-31
I need to replace accented characters in a string with their unaccented counterparts and
I need help with Javascript. I need to replace however many characters there are
I need to replace url invalid characters with something url valid then convert it
I need to send HTML emails directly from oracle PL/SQL package. This works almost
I need to replace characters in a QString based on their QChar::category . In
In each column, after first 5 characters I need to add/replace next 5 characters
In code igniter I need to replace illegal characters of 4th segment with '-',
I cant get this to work. I am trying to replace certain characters when

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.