Saturday, July 2, 2011

Re: [android-developers] String.split(regex) behaving funny

Thanks!

On Jul 2, 2011 2:37 PM, "Kostya Vasilyev" <kmansoft@gmail.com> wrote:
> The vertical bar has special meaning in Java regular expressions.
>
> Use split("\\|") instead.
>
> -- Kostya
>
> 02.07.2011 23:24, doles пишет:
>> Hello Everybody,
>>
>> On 3.1, I have a string like this:
>> 130097|2.AQBZGBy6H.600.109.3-4061710|SLC2X7cz9e5-3J68Q . It looks like
>> 3 parts separated by a '|'. So, when I use split on it like this:
>>
>> String [] parts = accessToken.split("|");
>>
>> I expect parts to be of length 3. Surprisingly, when i run and step
>> into that part, the length for parts comes to as many characters there
>> are in that string and not 3. So android String.split does not work
>> like java's string.split?
>>
>> Thanks!!!
>
> --
> Kostya Vasilyev
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment