tailorlala / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Splitter for Key-Value separator with multiple spaces. #1879

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
(Sorry for my English)
I have been trying to split string into a map but I facing issue when i have 
multiple spaces.

For example i am trying to split the string "Ticketno 10745 && Description Test 
Description && Priority 1 - Critical && status New".

I tried this to split like,
   Map<String, String> map = Splitter.on("&&").trimResults().withKeyValueSeparator(' ').split("Ticketno 10745 && Description Test Description && Priority 1 - Critical && status New");

Which should give a map key-value like,
Ticketno->10745
Description->Test Description
Priority->1 - Critical
status->New

But this not throwing invalid entry.
Can anyone suggest me the right way to use Splitter to achieve this

Original issue reported on code.google.com by y2amirma...@gmail.com on 10 Aug 2015 at 11:11