473,403 Members | 2,222 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,403 software developers and data experts.

Check if string contain Uppercase.

Ken
Is there a way if a string contain upper cas letter?
Is there a way if a string contain Numbers?
Is there a way if a string contain (Puntuation/Symbols) such as ~,!,#,$....?

Thanks
May 2 '07 #1
2 10878
On May 2, 10:43 am, "Ken" <k...@jeromegroup.comwrote:
Is there a way if a string contain upper cas letter?
Is there a way if a string contain Numbers?
Is there a way if a string contain (Puntuation/Symbols) such as ~,!,#,$....?

Thanks
Regex can do all of this. I typed these patterns on-the-fly so they
may not be perfect:

Dim theString As String = "$10 = Ten Dollars"

If Regex.IsMatch(theString, "[A-Z]") Then MsgBox("Has Capital
Letter(s)")

If Regex.IsMatch(theString, "\d") Then MsgBox("Has Numbers")

If Regex.IsMatch(theString, "[^\w\d\s]") Then MsgBox("Has
Symbols")

Thanks,

Seth Rowe
May 2 '07 #2
If Regex.IsMatch(theString, "[A-Z]") Then MsgBox("Has Capital
>Letter(s)")
[\p{Lu}] would be more i18n friendly.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
May 2 '07 #3

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

Similar topics

10
by: Hank Kingwood | last post by:
This is probably an easy question, but I can't find a function (maybe my syntax is off...) to search for in a string. If someone would help out, I'd appreciate it! Also, how would you...
6
by: Bart Nessux | last post by:
number = random.sample(range(count), 1) This makes 'number' into a one entry list (I don't know why as 'count' is an integer). Is there an easy way to convert 'number' back to an int? TIA
2
by: Thomas McK | last post by:
Hi all, I'm trying to make a SQL query (against a table in MS Access) where I want to take the value of something, and check to see if the first two letters in that value are capitalized (for...
3
by: Amy | last post by:
Hi, I have 6 If Then Else statements I was supposed to write. I did so but I know that they have to be wrong because they all look the same. Could someone take a look at them and point me in the...
10
by: John Salerno | last post by:
Can someone tell me what's happening here. This is my code: PUNCT_SPACE_SET = set(string.punctuation + string.whitespace) def filter_letters(original): return ''.join(set(original) -...
9
by: sellcraig | last post by:
Microsoft access 2 tables table "data main" contains a field called "code" table "ddw1" is created from a make table query of "data main" Goal- the data in "code" field in needs to...
14
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...
1
by: chilly53 | last post by:
I have a datagrid that has pulled a bunch of entries from a database in which all the entries were in all caps. I passed each entry through the VBStrConv function to ProperCase before displaying...
4
by: cpptutor2000 | last post by:
Could some C guru provide some hints on my problem? I am trying to sort an array of character strings, where each string contains lowercase, uppercase, digits as well as non-alphanumeric characters...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
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...
0
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...

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.