473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 3345
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
7
by: Ben Bateman | last post by:
I am working on a small program that needs to evaluate a string input by a user that will check for all the upper or lower case letters, compare them, give an option to covert the upper to lower...
8
by: Börni | last post by:
Hi, Is there a way to provide a default for a function parameter. i tried function func (type, message, obj = "message") but it doesn't seem to work. It seems a bit ugly to make an if/else...
3
by: Anna | last post by:
Hi. I want to write a program which does different functions according to input. I need to write it as general as possible. Example: input: Beep 2 <should call a function which does the...
15
by: phil-news-nospam | last post by:
This question is borderline between language and programming, but I want to focus more on the language standards issue, rather than the programming issue, so I am posting here. I have a number...
12
by: AMT2K5 | last post by:
Hello. I have the following function titled cleanSpace that recieves a string and cleans it up. My program passes a string to the function via "cleanSpace(c)". The function works the first time...
5
by: Daz | last post by:
Hi everyone. My query is very straight forward (I think). What's the difference between someFunc.blah = function(){ ; } and
7
by: Protoman | last post by:
Is this an efficient way to integrate an explicit function of x from a to b: #include <iostream> using namespace std; class Integrate { public: Integrate(long double (*f)(long double&...
7
by: Terry Olsen | last post by:
How do I get this to work? It always returns False, even though I can see "This is True!" in the debug window. Do I have to invoke functions differently than subs? Private Delegate Function...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.