Retrieve data after hypen

Suppose you have a string separated by hypen("-").If you want only the portion which comes after hypen("-") then you have to write


public static String getID(String value)
{
          return value.Split('-')[value.Split('-').Length - 1].Trim();
}

Comments