First split then join a subset of a string
Since the _
after the thumb is always the first instance then Substring
should be perfectly viable in conjunction with IndexOf
.
string newString = myString.Substring(myString.IndexOf("_") + 1);
This should take the substring starting at the character immediately following the first instance of the _
character.
If you wish to get the second index of _
, here's what I recommend:
int first = myString.IndexOf("_");
int second = mystring.Substring(first).IndexOf("_");
See this answer by Jon Skeet to the question "Index of the nth occurrence of a string?" for support for this approach.
If you don't like indexOf, but want Join instead:
String.Join("_",
"thumb_634735515600845357tchayat_november_200612.jpg"
.Split('_')
.Skip(1)
.ToArray())
After splitting and rearranging you can use Join method.
string new_value=String.Join("",your_array);