c# - Get a part of string -
c# - Get a part of string -
i have string as
"cmp197_10_27_147ee7b825-2a3b-4520-b36c-bba08f8b0d87_tempdoc_197"
i want fetch lastly digits(i.e. 197) obtaining same have implemented below code
int lastunderscore = adducoid.lastindexof('_'); string getucoid = adducoid.substring(lastunderscore).trimstart('_');
the getucoid
string gets digit part properly.the problem have check if digits occur in string,i.e. string can
"cmp197_10_27_147ee7b825-2a3b-4520-b36c-bba08f8b0d87_tempdoc"
how perform check on such string, whether part(197) exists @ end in string or not.
here 197 example.it numeric data,for illustration 196,145,etc
i suspect want know if lastly part numeric or not:
bool isnumeric = regex.ismatch(getucoid, @"^\d+$");
c# string
Comments
Post a Comment