ASP-Based Webmail: Include Original Reply Formatting

J

JStrummer

I'm building an ASP-based CRM system; a user sees the original
message, posted from the database and can hit a Reply button to
generate a TEXTAREA field on the next page that houses the original
messages and allows them to type a reply and hit a "Send" button.

The original message from the database includes natural line breaks,
as submitted--it doesn't contain any HTML breaks.

I would like to accomplish two things:

1) Add a "> " before each line of the original message, as contained
in the reply

2) In conjunction with the "> " preceding each line, break the
original messge string into logical line lengths that fit inside the
textarea field and don't wrap

Any help would be appreciated.
 
C

Coz

might be a faster way, but you could loop and break the string up..in this
example, into 75 char lines:

x=0
str=""
Do while x<=len(str)
str=str & ">" & Mid (str, x, x+75) & vbCrLf
x=x+75
Loop
 
E

Evertjan.

Coz wrote on 27 aug 2004 in microsoft.public.inetserver.asp.general:
might be a faster way, but you could loop and break the string up..in
this example, into 75 char lines:

x=0
str=""
Do while x<=len(str)
str=str & ">" & Mid (str, x, x+75) & vbCrLf
x=x+75
Loop

Not very nice to break the words.

Using jscript, try this:

s += ' '
s = s.replace(/(.{1,70}) /g,"> $1\n")

or vbscript:

Set regEx = New RegExp
regEx.Pattern = "(.{1,70}) "
regEx.Global = True
s = regEx.Replace(s&" ","> $1" & vbCrLf)
 

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

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top