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

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

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