469,917 Members | 1,620 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

Function to evaluate whether a string is all UPPER

I'm trying to clean up strings in a web form before I plug the fields
into a database. Lots of folks like to leave caps lock key on and
yell their form entries.

I can figure out how to change strings to sentence case, but I don't
want to do it to every string since some correctly entered words e.g.
"to" would be converted unnecessarily (to "To"). I'm willing to live
with the over correction on a few strings, but don't want to apply it
to the entire database.

Has anyone used a function to evaluate whether a string has been
entered all in upper case?
Thanks,

Brad Smith
pbs at myrealboxNOSPAM.com
remove NOSPAM from address and replace at with @ to email me directly
Nov 17 '05 #1
2 3227
Convert the string to all upper case, and compare the result to the original
string. If they are equal, the original string is all upper case.

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Big things are made up of
lots of Little things.

"Brad Smith" <pb*@mailandnews.com> wrote in message
news:65**************************@posting.google.c om...
I'm trying to clean up strings in a web form before I plug the fields
into a database. Lots of folks like to leave caps lock key on and
yell their form entries.

I can figure out how to change strings to sentence case, but I don't
want to do it to every string since some correctly entered words e.g.
"to" would be converted unnecessarily (to "To"). I'm willing to live
with the over correction on a few strings, but don't want to apply it
to the entire database.

Has anyone used a function to evaluate whether a string has been
entered all in upper case?
Thanks,

Brad Smith
pbs at myrealboxNOSPAM.com
remove NOSPAM from address and replace at with @ to email me directly

Nov 17 '05 #2
Hi Brad,

Could you try this:

string a = "Dodo";
if (a == a.ToUpper())
{
// the string is all in uppercase!
}

Thanks,
Blaise Pascal Tine (MSFT).
--------------------
From: pb*@mailandnews.com (Brad Smith)
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: Function to evaluate whether a string is all UPPER
Date: 27 Jun 2003 08:27:00 -0700
Organization: http://groups.google.com/
Lines: 19
Message-ID: <65**************************@posting.google.com >
NNTP-Posting-Host: 129.111.166.176
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1056727621 21410 127.0.0.1 (27 Jun 2003 15:27:01 GMT)X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: 27 Jun 2003 15:27:01 GMT
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
e.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-01!sn-
xit-09!supernews.com!postnews1.google.com!not-for-mailXref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:155460
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

I'm trying to clean up strings in a web form before I plug the fields
into a database. Lots of folks like to leave caps lock key on and
yell their form entries.

I can figure out how to change strings to sentence case, but I don't
want to do it to every string since some correctly entered words e.g.
"to" would be converted unnecessarily (to "To"). I'm willing to live
with the over correction on a few strings, but don't want to apply it
to the entire database.

Has anyone used a function to evaluate whether a string has been
entered all in upper case?
Thanks,

Brad Smith
pbs at myrealboxNOSPAM.com
remove NOSPAM from address and replace at with @ to email me directly


Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Penn Markham | last post: by
7 posts views Thread by Ben Bateman | last post: by
8 posts views Thread by Börni | last post: by
3 posts views Thread by Anna | last post: by
15 posts views Thread by phil-news-nospam | last post: by
12 posts views Thread by AMT2K5 | last post: by
7 posts views Thread by Terry Olsen | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.