473,667 Members | 2,789 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3364
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*@mailandnew s.com> wrote in message
news:65******** *************** ***@posting.goo gle.com...
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.publi c.dotnet.framew ork.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**********@go ogle.com
NNTP-Posting-Date: 27 Jun 2003 15:27:01 GMT
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!new sfeed00.sul.t-online.de!t-onlin
e.de!news-spur1.maxwell.s yr.edu!news.max well.syr.edu!sn-xit-03!sn-xit-01!sn-
xit-09!supernews.co m!postnews1.goo gle.com!not-for-mailXref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1554 60
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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
4950
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 webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or anything...it just returns a "1" (whereas it should return a "0") as far as I can tell. I have read the PHP...
7
7624
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 and lower to upper and then display the changes on the screen. My instructor says that there is an ascii function that will help me do this, but I cannot find anything on the web or in the book that was given to me in the class to help me with...
8
1772
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 statement right at the begining of a function, just to imitate this behavior.
3
1782
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 beep (parameter = 2)*/ Funny_text 5 3 <should call a function which writes funny text (parameters: 5,3) */
15
2051
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 of functions which are front-ended by macros which make some changes in the way the functions are called. There are various things being done, but one simple example would be a function that takes a variable number of (const char *) arguments and...
12
2003
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 through, but the second time through I recieve a seg fault on the second last line, strcpy. I am certain something is wrong with the pointer and the way I use it. Could somebody identify what I have done wrong at that line? int...
5
2233
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
1943
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& x)):fn(f){}
7
10317
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 IsLvItemCheckedDelegate(ByVal ClientID As Integer) As Boolean Private Function IsLvItemChecked(ByVal ClientID As Integer) As Boolean If lvServers.InvokeRequired = True Then lvServers.Invoke(New IsLvItemCheckedDelegate(AddressOf IsLvItemChecked),...
0
8458
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8366
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8888
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8790
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8565
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2779
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.