Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Force Character Wrap.

Reply
Thread Tools

Force Character Wrap.

 
 
Adam
Guest
Posts: n/a
 
      01-23-2004
Hello is there a function in ASP that can force a database result to
automatically wrap at say.. 25 characters in length?

Reason for this is because I have a database and people could go in and put
a message like

"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM"

and when it is displayed on the site it will make the layout all messed up.

If someone knows how to do this I would be very great ful, Thanks!


 
Reply With Quote
 
 
 
 
Steven Burn
Guest
Posts: n/a
 
      01-24-2004
Function FormatOutput(strData)
Select Case Len(strData)
Case < 25 'Under 25 chars
'Do something
Case > 25 'Over 25 chars
'Do something
End Select
End Function

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)


Adam <(E-Mail Removed)> wrote in message
news:ZkiQb.20366$(E-Mail Removed). ..
> Hello is there a function in ASP that can force a database result to
> automatically wrap at say.. 25 characters in length?
>
> Reason for this is because I have a database and people could go in and

put
> a message like
>
> "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM"
>
> and when it is displayed on the site it will make the layout all messed

up.
>
> If someone knows how to do this I would be very great ful, Thanks!
>
>



 
Reply With Quote
 
 
 
 
Tim Slattery
Guest
Posts: n/a
 
      01-26-2004
"Adam" <(E-Mail Removed)> wrote:

>Hello is there a function in ASP that can force a database result to
>automatically wrap at say.. 25 characters in length?
>
>Reason for this is because I have a database and people could go in and put
>a message like
>
>"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM"
>
>and when it is displayed on the site it will make the layout all messed up.
>
>If someone knows how to do this I would be very great ful, Thanks!


Keep in mind that your browser will wrap text, but will only break it
where there's a space. The long string of Ms above has no space, so
the browser won't break it. It's likely that the actual data will have
spaces (though, of course, I know nothing about your data) and will
break properly.

I mention this because our testing department made my web app's
display distort terribly by using a long string of characters with no
spaces. In real life, the string would be words separated by spaces,
and would break and wrap appropriately. I wasted far too much time
figuring that out!

--
Tim Slattery
MS MVP(DTS)
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
Dave Anderson
Guest
Posts: n/a
 
      01-26-2004
"Adam" wrote:
>
> Hello is there a function in ASP that can force a database
> result to automatically wrap at say.. 25 characters in
> length?
>
> Reason for this is because I have a database and people
> could go in and put a message like
>
> "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM"
>
> and when it is displayed on the site it will make the layout
> all messed up.


If you really want to avoid displaying such messages, why not simply reject
them instead of inserting them into your DB? Warn the user that his message
will be rejected (or that it was not recorded due to the long string), and
leave it at that.

The easiest way to test for long unbroken strings is with a regular
expression. Try something like this:

JScript:
if (/\w{25}/.test(myVar)) ... //-- Reject string

VBScript:
Dim rx
Set rx = New RegExp
rx.Pattern = "\w{25}"
If rx.Test(strMyValue) Then
... ' Reject the string
End If

VBScript RegExp Object:
http://msdn.microsoft.com/library/en...sobjregexp.asp

Regular Expression Syntax (applies to both VBScript and JScript):
http://msdn.microsoft.com/library/en...gexpsyntax.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
Nike air force one, air force 1, air force one low cut, air force one abdul_razak@indiatimes.com Digital Photography 2 12-31-2008 04:29 PM
Nike Air Force Ones,Air Force One Air Force One-1 lky52193@gmail.com Computer Support 0 01-17-2008 04:40 PM
Nike Air Force Ones,Air Force One Air Force One-1,25th anniversary lky52112@gmail.com Digital Photography 0 01-15-2008 04:46 PM
Nike Air Force Ones,Air Force One Air Force One-1,25th anniversary lky52112@gmail.com Digital Photography 0 01-15-2008 04:34 PM
Force long line wrapping at some character Gnarlodious HTML 9 01-28-2005 08:08 AM



Advertisments