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

Re: Length of words in a string. by Tim

Tim
Fri Jan 27 15:03:19 CST 2006

"MN" <MN@discussions.microsoft.com> 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)
Slattery_T@bls.gov

Re: Length of words in a string. by MN

MN
Fri Jan 27 15:15:27 CST 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" <MN@discussions.microsoft.com> 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)
> Slattery_T@bls.gov
>

Re: Length of words in a string. by Hal

Hal
Sat Jan 28 16:22:34 CST 2006


"MN" <MN@discussions.microsoft.com> wrote in message
news:7F54FA55-E69F-4377-9F89-0EE6EF9FB9E0@microsoft.com...
> 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




Re: Length of words in a string. by Giles

Giles
Sun Jan 29 06:23:36 CST 2006

"MN" <MN@discussions.microsoft.com> 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