find uppercase chars in string

nandoliveira

Member
Joined
Jun 17, 2008
Messages
7
Programming Experience
Beginner
hi, i'm new in Vb.Net programming and i need to do a litle function that recives one string and return 1 if there are letters uppercase [with exception of the first one] and zero in oposite case:

Exemple:

"This string is good" ==>> return 0
"This String have Capitall letters in the midle " ==>> return 1

Thanks for the attencion

:)
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,412
Location
Norway
Programming Experience
10+
Try this function, it ignores first char:
Code:
Function ContainsCapitals(ByVal s As String) As Boolean
    s = s.Substring(1)
    Return s <> s.ToLower
End Function
 
Top Bottom