c# - how to find the word and split the integer and characters in a string -


please tell me question answer please ...

string ss="pradeep rao having 2years exp"; 

in above string want find word of years(or) year , if match the word,i wnt split word

string s="2"; string s1="years(or)year" 

thanks pradeep

easiest way regular expression so:

regex = new regex("(\d+)(years?)");  match match = regex.match(ss); if(match.success) {   string s = match.groups[1];   string s1 = match.groups[2]; } 

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -