string

A

amatuer

Hi guys, i need some help please. i have a string and i would like to
run through this string to find a "."(fullstop), and once found put a
break in so that i could continue the rest of the string on the next
line.

can anyone help please?
thanks a mil
 
E

Evertjan.

amatuer wrote on 13 dec 2007 in microsoft.public.inetserver.asp.general:
Hi guys, i need some help please. i have a string and i would like to
run through this string to find a "."(fullstop), and once found put a
break in so that i could continue the rest of the string on the next
line.

ASP-jscript:

s = s.replace(/\./,'.<br>');

The same with all dots replaced:

s = s.replace(/\./g,'.<br>');
 
M

Mike Brind

amatuer said:
Hi guys, i need some help please. i have a string and i would like to
run through this string to find a "."(fullstop), and once found put a
break in so that i could continue the rest of the string on the next
line.

can anyone help please?
thanks a mil

VBScript:

s = Replace(s, ".", ".<br>")
 
A

Anthony Jones

amatuer said:
Hi guys, i need some help please. i have a string and i would like to
run through this string to find a "."(fullstop), and once found put a
break in so that i could continue the rest of the string on the next
line.

sMyText = Replace(sMyText, ".", ".<br />")
 
P

p byers

Or even

sMyText = Replace(sMyText, ".", (".<br />" & VbCrLf))

To avoid long lines and to enhance the readablity of the script

Pete (Northolt UK)
 
E

Evertjan.

p byers wrote on 14 dec 2007 in microsoft.public.inetserver.asp.general:
Or even
sMyText = Replace(sMyText, ".", (".<br />" & VbCrLf))
To avoid long lines and to enhance the readablity of the script

Good plan, but please do not toppost on usenet,
and do not quote signatures.

The script is of limited use, because would you want:

"socks € 5.23.shoes € 29.95."

to be changed to:

"socks € 5.
23.
shoes € 29.
95.
"

?

No, that is where regex will do somewhat(!) better,
[js example]:

s = s.replace(/\.([\D]|$)/g,'.<br>$1');

You can do the same with vbs regex but not in one statement line.

This would only "fail" for:

"6 socks € 5.23.2 shoes € 29.95."
 
A

Anthony Jones

p byers said:
Or even

sMyText = Replace(sMyText, ".", (".<br />" & VbCrLf))

To avoid long lines and to enhance the readablity of the script


Readability of what script and why would it need to be readable?
 
P

p byers

I rather stupidly assumed that the question related to an 'ASPage'
Also stupidly, maybe that the purpose of an 'ASPage' would be to
generate some HTML script to be served to the client.

When I serve such pages, I like to be able to Right Click on the page in
the Browser and see the source if I have any problems.

I now have learned my lesson, I will keep my stupid assumptions to
myself - especially in respect of posts from MVPs

Sorry
Pete (Northolt UK)
 
A

Anthony Jones

p byers said:
I rather stupidly assumed that the question related to an 'ASPage'
Also stupidly, maybe that the purpose of an 'ASPage' would be to
generate some HTML script to be served to the client.

When I serve such pages, I like to be able to Right Click on the page in
the Browser and see the source if I have any problems.

I now have learned my lesson, I will keep my stupid assumptions to
myself - especially in respect of posts from MVPs


I apologise, you're quite right view source is a reasonable and useful tool.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top