String.split(“*”) return Exception in Android Eclipse
Is there Any solution…
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.
String#split("*")should throw an exception.String#splitaccepts a regular expression string, and"*"is an invalid regular expression. The*means “zero or more of the previous item” but there is no previous item.If you’re trying to split literally on asterisks, use:
split("\\*"). There are two backslashes because you need to pass a backslash to the regular expression parser to tell it that the*is literal, and of course this is in a string, so to get a backslash, you have to escape it. Hence, two.