.net - Easiest way to extract 4 digit number out of string? -


if know string going like:

abc xyz 5678

or

qweroi yreoiu 4679

what best way extract last 4 digit string?

in c# whole thing

string mystring = "qweroi yreoiu 4679"; regex regex = new regex(@"\d{4}$"); match result = regex.match(mystring); 

you can use .tostring() if need keep working match. additional information regex recommend this article.


Comments

Popular posts from this blog

Issues changing the value of an element in an array in matlab -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

vb.net - Alternative to the T-SQL AS keyword -