How to split a string on the 3rd occurence of a char C# -
i wondering there way split string on 3rd occurence of char? when splitting using:
line.substring(line.lastindexof(']') +1);
i hadn't realised of strings had square brackets others ideally need split on 3rd occurence of ']' same position on every string.
input: [wed dec 17 14:40:28 2014] [error] [client 143.117.101.166] file not exist:
output:
[wed dec 17 14:40:28 2014] [error] [client 143.117.101.166]
file not exist:
you need split string first take index of 3rd ]
line.substring(line.indexof(line.split(']')[3]));
or more easy said 3rd index of ] same, put fixed
line.substring(59);
Comments
Post a Comment