Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 spliting quoted and/or escaped tokens in a string
#1
i think i asked this a while back because i remember a "can't find anything" answer. so i wonder if any answers have popped up. i want to do a generic split like the str.split() method with no arguments, but with support for tokens that are quoted within the string being split and might even have spaces, such as "foo 'foo bar' bar" -> ['foo','foo bar','bar'] as well as support for backslash escape sequences (doubled here like you would in python source code) "foo foo\\ bar bar" giving the same list. you might get strings like this reading from a file.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Quote
#2
now i am thinking it could be useful if there was a way to have a string parsed as code and return the parse tree.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Quote

Top Page

Forum Jump:


Users browsing this thread: 1 Guest(s)