I wanted to substring from special point.
abcdef.png
I want
.png
Here i tried
string str = "abcdef.png";
str = str.Substring(0, str.Length - 4);
but then only shows the abcdef only BUT i want .png part
Just use the overload which takes a single parameter - the start point:
str = str.Substring(str.Length - 4);
Or better, use a method designed to get the extension of a filename - Path.GetExtension
:
string extension = Path.GetExtension(str);
See more on this question at Stackoverflow