Monday, April 23, 2012

Regex to find first capital letter occurrence in a string

I want to find the index of first capital letter occurrence in a string.



E.g. -



String x = "soHaM";


Index should return 2 for this string. The regex should ignore all other capital letters after the first one is found. If there are no capital letters found then it should return 0. Please help.





No comments:

Post a Comment