My question is that I want to split string in java with delimiter ^.
And syntax which I am using is:
readBuf.split("^");
But this does not split the string.Infact this works for all other delimiters but not for ^.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
splituses regular expressions (unfortunately, IMO).^has special meaning in regular expressions, so you need to escape it:(The first backslash is needed for Java escaping. The actual string is just a single backslash and the caret.)
Alternatively, use Guava and its
Splitterclass.