Skip to main content
The 2024 Developer Survey results are live! See the results
27 events
when toggle format what by license comment
Aug 25, 2012 at 17:33 history edited abatishchev
edited tags
Aug 25, 2012 at 11:21 comment added Eric If values contain colons, this cannot be done. Consider a:b c:d. Is that two pairs, a => b and c => d, or just one, a => b c:d?
Aug 25, 2012 at 11:12 history edited Peter Mortensen CC BY-SA 3.0
(its = possessive, it's = "it is" or "it has".)
May 31, 2011 at 13:01 vote accept leora
May 31, 2011 at 12:53 comment added Wonko the Sane It seems as though all the solutions below assume certain things about the value. You will need to either get some control of the input, or at least some guarentee of the input, in order to insure proper parsing. In other words, you must guarentee that the input follows some format (key, delimiter, value), where the delimiter can never be found in the key or value, or the value is always enclosed in quotes, or... In other words, to use a pattern parser, there must be a guarenteed pattern to parse.
May 31, 2011 at 12:42 answer added Simon Mourier timeline score: 0
May 31, 2011 at 12:07 answer added Mud timeline score: 4
May 31, 2011 at 12:05 answer added DeveloperX timeline score: 1
May 31, 2011 at 12:05 comment added Jason Moore @ ooo thanks for the clarification on the spaces not being in the keys. Now this problem is solvable (assuming there are no colons in both the key and the value).
May 31, 2011 at 11:51 answer added Jason Moore timeline score: 0
May 31, 2011 at 11:45 answer added Episodex timeline score: 22
May 31, 2011 at 11:40 history edited leora CC BY-SA 3.0
added 41 characters in body
May 31, 2011 at 11:27 comment added leora @All - keys will NOT have spaces in them
May 31, 2011 at 11:26 history edited leora CC BY-SA 3.0
added 73 characters in body; added 1 characters in body
May 31, 2011 at 11:24 comment added Jodrell +1 to vidstige, can we assume keys may not have spaces, can : be escaped?
May 31, 2011 at 11:22 answer added Carra timeline score: 5
May 31, 2011 at 11:22 comment added ZombieSheep Do you know in advance what allowable keys would be? If so, and you have to allow for spaces and colons within your delimited strings, you can minimise your pain with a bit of substitution on the input.
May 31, 2011 at 11:18 answer added abatishchev timeline score: 1
May 31, 2011 at 11:14 answer added ZombieSheep timeline score: 0
May 31, 2011 at 11:09 comment added vidstige this cannot be done. How do you know if a word belongs to the value or to the next key?
May 31, 2011 at 11:06 history edited leora CC BY-SA 3.0
deleted 33 characters in body
May 31, 2011 at 11:05 answer added Johann du Toit timeline score: 2
May 31, 2011 at 11:04 comment added leora @jdehaan - good point. I know there is definitely no ":" in the key but i can possibly imagine that showing up in the value one day (even though i can't find an example now). I obviously want to be a bit future proof
May 31, 2011 at 11:03 comment added jdehaan Is it at least enforced that there is no : possible inside values? if not, you are stuck. If you generate the long string, then you have the possibility to escape the characters to avoid the trouble, but then you'll need something better than Split to read the input.
May 31, 2011 at 11:02 comment added leora @Jason - i am trying to get control, in which case i will change the separator character but i am still concerned that whatever character i use as a separator could also be in the value field.
May 31, 2011 at 11:01 comment added Stefan do you have control over the input format?
May 31, 2011 at 10:58 history asked leora CC BY-SA 3.0