Friday, 1 March 2013

How to escape ( in android?

I keep making the same mistake and get annoyed for half an hour. Here is the way to escape ( in android method such as split

    String lineStr = stopName.split("\\(")[1];

All you need is to add a double slash. I get error because I add only single slash. and when i add double, the warning does not go away. the right way is to just add the \\ and go ahead and run it :)

No comments:

Post a Comment