Try it:
string input = "Hello_World" string output = input.Substring(input.IndexOf('_') + 1); output = World
You can use the IndexOf method and the Substring method.
Create your function as follows
public string RemoveCharactersBeforeUnderscore(string s) { string splitted=s.Split('_'); return splitted[splitted.Length-1] }
Use this function as follows
string output = RemoveCharactersBeforeUnderscore("Hello_World") output = World
source share