Results 1 to 5 of 5

Thread: How to remove unwanted linefeeds and carriage returns?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    How to remove unwanted linefeeds and carriage returns?

    I get an old recordset from the sql server database.

    And I use server side vbcode to write javascript onto a webpage.
    The problem I get is that in some of the records I find CR and LF, that makes the javascript garbage...

    For every string I write in the javascript, I perform a replace using \n

    But yet the LF and CR remains. I checked the output in the hex editor and I find both 0D and 0A... and yet the replace method has replaced the \n with a blank...

    So, are there any other ways in vb to completly get rid of the Carraige returns??


    kind regards
    Henrik

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How to remove unwanted linefeeds and carriage returns?

    Try replacing \n and \r as well.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    Re: How to remove unwanted linefeeds and carriage returns?

    I haven't tried using regular expressions... does anyone know how to write a reg exp that matches all occurences of carraige return? then i use the string.replace method


    kind regards
    Henrik

  4. #4
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    Re: How to remove unwanted linefeeds and carriage returns?

    string sRegularExpression = "([\\n\\r]+)"; //Match either of x0D or x0A one or more times.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    Re: How to remove unwanted linefeeds and carriage returns?

    thanks, it worked!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width