Need to take year from the value

For example:
ABC00D716161682019

MY OUTPUT SHOULD BE

2019
ie the last 4 digit of the above value

Hi @sruthesanju

How about this expression?

System.Text.RegularExpressions.Regex.Match(YourString,"\d{4}$").Tostring

image

Hi @sruthesanju

You can utilise Substring functionality to get only last 4 characters.

To get last four characters from string you can use string.Substring(Int32, Int32) and give it the String.Length-4 and 4 . It will get the substring of last 4 characters.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.