Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Splitting a string array

Tags:

string

c#

split

I have a string array string[] arr, which contains values like N36102W114383, N36102W114382 etc...
I want to split the each and every string such that the value comes like this N36082 and W115080.

What is the best way to do this?

like image 533
Everest Avatar asked Dec 21 '25 07:12

Everest


1 Answers

This should work for you.

Regex regexObj = new Regex(@"\w\d+"); # matches a character followed by a sequence of digits
Match matchResults = regexObj.Match(subjectString);
while (matchResults.Success) {
    matchResults = matchResults.NextMatch(); #two mathches N36102 and W114383
}
like image 160
Narendra Yadala Avatar answered Dec 22 '25 21:12

Narendra Yadala



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!