Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > replace function

Reply
Thread Tools

replace function

 
 
Øyvind Isaksen
Guest
Posts: n/a
 
      01-01-2006
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?







 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      01-02-2006
Ø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)
 
Reply With Quote
 
 
 
 
Dave Anderson
Guest
Posts: n/a
 
      01-02-2006
Ø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...26e97000d2.asp


....rather than the Replace Function:
http://msdn.microsoft.com/library/en...657489dd34.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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace /n with a XHTML <br /> using string.replace Alun ASP .Net 3 02-18-2008 05:52 AM
how to make replace function replace globally in a string V S Rawat Javascript 5 07-03-2007 08:02 PM
Re: [Pyrex] pyrex functions to replace a method (Re: replace a method Greg Ewing Python 2 06-29-2006 05:25 PM
pyrex functions to replace a method (Re: replace a method in class:how?) Brian Blais Python 1 06-27-2006 12:13 PM
help with string replace - for doing selective replace Prasad S Javascript 2 08-27-2004 03:22 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57