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

Popular posts from this blog

Using django-mptt to get only the categories that have items -

ruby - Train neural network with sine function -

javascript - Java with RWeka packege -