473,659 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Lowercase lettter in a string ?

What is the fastest way to tell in string contains lower case letters?
Nov 16 '05 #1
4 7610
Hi, Marlon,

fastest in complexity or in writing?

You can use simply
if (mystring.ToLow er() != mystring)

If you need fastest in execution then I don't have simple answer. It depends
on strings - how big they are and where from come

HTH
Alex

"Marlon R" <mr***@exhibitw orks.com> wrote in message
news:eN******** ******@TK2MSFTN GP11.phx.gbl...
What is the fastest way to tell in string contains lower case letters?

Nov 16 '05 #2
"AlexS" <sa***********@ SPAMsympaticoPL EASE.ca> wrote in message
news:eh******** ******@TK2MSFTN GP09.phx.gbl...
You can use simply
if (mystring.ToLow er() != mystring)


er.umm... if (mystring.ToUpp er() != mystring)

(Imagine if mystring was all lower case to begin with.....)
--
Truth,
James Curran
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
(note new day job!)
Nov 16 '05 #3
Right,
good that someone remarked!

Rgds
Alex
"James Curran" <Ja*********@mv ps.org> wrote in message
news:uF******** ******@TK2MSFTN GP12.phx.gbl...
"AlexS" <sa***********@ SPAMsympaticoPL EASE.ca> wrote in message
news:eh******** ******@TK2MSFTN GP09.phx.gbl...
You can use simply
if (mystring.ToLow er() != mystring)


er.umm... if (mystring.ToUpp er() != mystring)

(Imagine if mystring was all lower case to begin with.....)
--
Truth,
James Curran
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
(note new day job!)

Nov 16 '05 #4

"Marlon R" <mr***@exhibitw orks.com> wrote in message
news:eN******** ******@TK2MSFTN GP11.phx.gbl...
What is the fastest way to tell in string contains lower case letters?


Not quite sure I understand your question but if you want to tell if a
string contains "any" lowercase letters then you can use regex.

if(Regex.IsMatc h("ABsF", "[a-z]", RegexOptions.Co mpiled |
RegexOptions.Ig norePatternWhit espace))
{
MessageBox.Show ("Match");
}

which will show "Match" if "any" of the characters in the string are
lowercase.

HTH
JB
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

37
7340
by: Zombie | last post by:
Hi, what is the correct way of converting contents of a <string> to lowercase? There are no methods of <string> class to do this so I fallback on strlwr(). But the c_str() method returns a const pointer which cannot be used with strlwr() as it does the conversion inplace. So, I use the following logic of copying the contents to a dynamically allocated char* array and then doing the conversion: -----------------------------
1
3255
by: The_Kingpin | last post by:
Hi all, I need to make a function that convert a string into a certain format. Here what are the restriction: -The first letter of the first and last name must be uppercase. -If a first name contains only 1 character, a '.' must follow the char. -If we find a character that isn't a letter (.&*-), we must swap it for a '/' and add the correct spaces. I tried making a function but my switch seems to have an error. If anyone
2
1344
by: Paul | last post by:
Hi, As most people who use the FileSystemWatcher know, it returns lowercase text for some strange reason. I know there's a workaround for the lowercase the FileSystemWatcher returns by by passing the 'FullPath' property into the constructor of a DirectoryInfo Class and reading the 'Name' property but I'm not sure how or where I'd fit that into my code. Could someone point me in the right direction? Cheers, Paul
7
3191
by: Jim Carlock | last post by:
Looking for suggestions on how to handle bad words that might get passed in through $_GET variables. My first thoughts included using str_replace() to strip out such content, but then one ends up looking for characters that wrap around the stripped characters and it ends up as a recursive ordeal that fails to identify a poorly constructed $_GET variable (when someone hand-types the item into the line and makes a simple typing error).
4
24875
by: Jim Langston | last post by:
Is there any builtin lowercase std::string compare? Right now I'm doing this: if ( _stricmp( AmmoTypeText.c_str(), "GunBullet" ) == 0 ) AmmoType = Item_Ammo_GunBullet; Is there anything the standard library to do this? I'm not interested in Boost until it becomes part of the standard.
22
18202
by: federico_bertola | last post by:
Hi everybody, I have an array of chars that I want to make all lower int Scan(char Search) { char *cPtr; cPtr = strtok (Search," -,."); while (cPtr != NULL) {
15
7019
by: Optimus | last post by:
I would like to know if there is a encryption algorithm that returns only lowercase encrypted string. Thanks in advance.
14
43801
by: fniles | last post by:
In VB.NET 2005 can I check if a letter in a string is upper case or lower case ? For example: I have the following 2 lines: NQ,Z2003,11/11/2003,1416.5,1420,1402,1411.5 NQ,z2003,11/10/2003,223801,260154 NQ,H2004,11/11/2003,1416.5,1422.5,1406.5,1415 NQ,h2004,11/10/2003,56,1191 Notice the 1st line has uppercase Z (Z2003) and the 2nd line has lowercase z
9
1968
by: Bob | last post by:
Hi, Maybe this problem has already been mentionned, but I am new to this group, so here we go. $string = "This is for ABC only" $new = (eregi_replace('ABC','<b>ABC</b>',$string)); print $new geeft nu
0
8851
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...
1
8535
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
8629
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
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...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4176
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4338
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2757
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
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.