replace function

Discussion in 'ASP General' started by Øyvind Isaksen, Jan 1, 2006.

  1. Hi!

    I use this function to show the text with linefeeds on my webpages:

    -----------------------------------
    replace(myText,Chr(13),"<br>")
    ----------------------------------

    This works perfect if the variable "myText" just contains pure text.
    But, if the variable contains a html table with break after the <table> tag,
    <tr> tag and <td> tag, the table will not come in the top of the page as I
    wanted.

    My question:
    Is there any smart way to "turn off" the replace-function just around the
    <table> content in the myText-variable?
     
    Øyvind Isaksen, Jan 1, 2006
    #1
    1. Advertising

  2. Øyvind Isaksen

    Evertjan. Guest

    Øyvind Isaksen wrote on 01 jan 2006 in
    microsoft.public.inetserver.asp.general:

    > Hi!
    >
    > I use this function to show the text with linefeeds on my webpages:
    >
    > -----------------------------------
    > replace(myText,Chr(13),"<br>")
    > ----------------------------------
    >
    > This works perfect if the variable "myText" just contains pure text.
    > But, if the variable contains a html table with break after the
    > <table> tag, <tr> tag and <td> tag, the table will not come in the top
    > of the page as I wanted.
    >
    > My question:
    > Is there any smart way to "turn off" the replace-function just around
    > the <table> content in the myText-variable?


    The above function is only usefull to convert a "paragraphed text" to html.

    Converting html, containing <td>, etc., with it is nonsense,
    as the carriage returns do not correspondent to a new line in the browser.

    Secondly, better use this as on windows platforma [ASP] the new line is
    Chr(13)&Chr(10), and that is VbCrLf:

    result = replace(myText,VbCrLf,"<br>")

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jan 2, 2006
    #2
    1. Advertising

  3. Øyvind Isaksen wrote:
    > My question:
    > Is there any smart way to "turn off" the replace-function just around
    > the <table> content in the myText-variable?


    Use the Replace method of the Regular Expression Object...
    http://msdn.microsoft.com/library/en-us/script56/html/810607c5-5926-43d9-b7e8-4126e97000d2.asp


    ....rather than the Replace Function:
    http://msdn.microsoft.com/library/en-us/script56/html/65e15b2c-99b6-4f82-88e7-8c657489dd34.asp




    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.
     
    Dave Anderson, Jan 2, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Blais
    Replies:
    1
    Views:
    387
    Bruno Desthuilliers
    Jun 27, 2006
  2. Greg Ewing
    Replies:
    2
    Views:
    353
    Dieter Maurer
    Jun 29, 2006
  3. Alun
    Replies:
    3
    Views:
    4,535
    Masudur
    Feb 18, 2008
  4. Prasad S
    Replies:
    2
    Views:
    240
    Dr John Stockton
    Aug 27, 2004
  5. V S Rawat
    Replies:
    5
    Views:
    315
    Richard Cornford
    Jul 3, 2007
Loading...

Share This Page