Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Length of words in a string.

Reply
Thread Tools

Length of words in a string.

 
 
MN
Guest
Posts: n/a
 
      01-27-2006
Hello all -

I'm really at wits end on this as I'm not having much success with locating
a function or other options I have. I'm working on a message board for a
website and I'm needing to check the length of the words that users put in.
For example, when someone puts in "yesssssssssssss!", I put together a small
function that omits all of the s's as this is wreaking havoc on the layout of
tables within the site. But I don't have a solution if someone types in
"ssss ssasdfjskldjfaskld;jfaskdf" as random ambiguous letters. I know I can
check the length of the entire string but don't know to check the words
within it.

Any help at this point is appreciated.

Thanks,
MN
 
Reply With Quote
 
 
 
 
Tim Slattery
Guest
Posts: n/a
 
      01-27-2006
"MN" <(E-Mail Removed)> wrote:

>Hello all -
>
>I'm really at wits end on this as I'm not having much success with locating
>a function or other options I have. I'm working on a message board for a
>website and I'm needing to check the length of the words that users put in.
>For example, when someone puts in "yesssssssssssss!", I put together a small
>function that omits all of the s's as this is wreaking havoc on the layout of
>tables within the site. But I don't have a solution if someone types in
>"ssss ssasdfjskldjfaskld;jfaskdf" as random ambiguous letters. I know I can
>check the length of the entire string but don't know to check the words
>within it.


What constitutes a word? Are they delimited by blanks? In that case
there are two in your string, one short and one quite long. Maybe by
spaces and semicolons. Now there are three strings, two short and one
rather long.

There's no way to be really certain as to what combination of letters
constitutes a word, other than a dictionary (and then you omit
something from the dictionary that one of your users *knows* is a
word.)

--
Tim Slattery
MS MVP(DTS)
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
MN
Guest
Posts: n/a
 
      01-27-2006
Thanks for responding Tim. To answer your questions, what constitues a word
for what I'm planning on would be a blank(s) between the words. Also, I was
considering setting a limit where if a "word" is encountered of more than 50
characters, I'd notify the user to rephrase. I'm sure there are words that
possibly could exist of that length but I would just notify the person to
re-phrase, rather than restrict them (i.e. just putting a space between your
50 character word so it's 2 25's) or something like that.

Thanks.

"Tim Slattery" wrote:

> "MN" <(E-Mail Removed)> wrote:
>
> >Hello all -
> >
> >I'm really at wits end on this as I'm not having much success with locating
> >a function or other options I have. I'm working on a message board for a
> >website and I'm needing to check the length of the words that users put in.
> >For example, when someone puts in "yesssssssssssss!", I put together a small
> >function that omits all of the s's as this is wreaking havoc on the layout of
> >tables within the site. But I don't have a solution if someone types in
> >"ssss ssasdfjskldjfaskld;jfaskdf" as random ambiguous letters. I know I can
> >check the length of the entire string but don't know to check the words
> >within it.

>
> What constitutes a word? Are they delimited by blanks? In that case
> there are two in your string, one short and one quite long. Maybe by
> spaces and semicolons. Now there are three strings, two short and one
> rather long.
>
> There's no way to be really certain as to what combination of letters
> constitutes a word, other than a dictionary (and then you omit
> something from the dictionary that one of your users *knows* is a
> word.)
>
> --
> Tim Slattery
> MS MVP(DTS)
> (E-Mail Removed)
>

 
Reply With Quote
 
Hal Rosser
Guest
Posts: n/a
 
      01-28-2006

"MN" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello all -
>
> I'm really at wits end on this as I'm not having much success with

locating
> a function or other options I have. I'm working on a message board for a
> website and I'm needing to check the length of the words that users put

in.
> For example, when someone puts in "yesssssssssssss!", I put together a

small
> function that omits all of the s's as this is wreaking havoc on the layout

of
> tables within the site. But I don't have a solution if someone types in
> "ssss ssasdfjskldjfaskld;jfaskdf" as random ambiguous letters. I know I

can
> check the length of the entire string but don't know to check the words
> within it.
>
> Any help at this point is appreciated.
>
> Thanks,
> MN


Look at the "split" function to separate a string into an array of strings
(words)
then you can check the length of the words, one by one - if thats what you
want to do.
look at "instr" function to see if one string is in another
look at the "mid" function to return parts of a string
look at the replace function to modify parts of a string
the "len" function returns the length of the string
left(stringname, 5) returns the first 5 characrters of stringname
and on and on
Check out this website
http://devguru.com/technologies/vbscript/13896.asp

It also has a decent reference for ASP and ADO and Javascript



 
Reply With Quote
 
Giles
Guest
Posts: n/a
 
      01-29-2006
"MN" <(E-Mail Removed)> wrote
> Thanks for responding Tim. To answer your questions, what constitues a
> word
> for what I'm planning on would be a blank(s) between the words. Also, I
> was
> considering setting a limit where if a "word" is encountered of more than
> 50
> characters, I'd notify the user to rephrase. I'm sure there are words
> that
> possibly could exist of that length but I would just notify the person to
> re-phrase, rather than restrict them (i.e. just putting a space between
> your
> 50 character word so it's 2 25's) or something like that.
>
> Thanks.


Assuming your window size can vary as the user resizes their browser, once
you have found the words that are too long to fit your smallest window size
(as suggested by Hal, with split), you can break them to allow wrapping by
inserting a space with a tiny font size
Yessssss<span style="font-size:1pt"> </span>ssssss
This clunk will be invisible in wide windows, and allow wrapping when
needed.
If you have a problem with the actual script needed to do this, let the
group know.
Giles


 
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
Re: Words and non-words, according to Microsoft et al Steve B NZ Computing 11 03-21-2008 11:52 PM
Replace stop words (remove words from a string) BerlinBrown Python 6 01-17-2008 02:37 PM
Words Words utab C++ 6 02-16-2006 07:00 PM
Non-noise words are incorrectly recognised as noise words. Peter Strĝiman ASP .Net 1 08-23-2005 01:26 PM
Re: A little bit of help regarding my linked list program required. - "words.c" - "words.c" Richard Heathfield C Programming 7 10-05-2003 02:38 PM



Advertisments