|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Check if string contain Uppercase.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 On May 2, 10:43 am, "Ken" <k***@jeromegroup.com> wrote: Regex can do all of this. I typed these patterns on-the-fly so they> 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 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 > If Regex.IsMatch(theString, "[A-Z]") Then MsgBox("Has Capital [\p{Lu}] would be more i18n friendly.>Letter(s)") Mattias -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup. |
|||||||||||||||||||||||