java - How to split string separated by | character -
i have input string in following format first|second|third|<forth>|<fifth>|$sixth
want split string array of string value [first,second,third,,,$sixth]. using following code split string not working. please me.
public string[] splitstring(string input){ string[] resultarray = input.split("|") return resultarray; }
could please tell me doing wrong.
you need escape |
using backslash special character. should work:
string[] resultarray = input.split("\\|")
Comments
Post a Comment