Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/split?V=75
QUERY_STRINGV=75
CONTENT_TYPE
DOCUMENT_URI/revision/split
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.69.59.186
REMOTE_PORT47086
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR18.221.187.121
HTTP_CF_RAY87b0679cbee71233-ORD
HTTP_X_FORWARDED_PROTOhttps
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
HTTP_CF_CONNECTING_IP18.221.187.121
HTTP_CDN_LOOPcloudflare
HTTP_CF_IPCOUNTRYUS

Body


Error

Unknow state transition: LINE -> END

-code

1

-level

0

-errorstack

INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit split split\ -\ Split\ a\ string\ into\ a\ proper\ Tcl\ list\n\n\n\nReturns\ a\ list\ created\ by\ splitting\ ''string''\ at\ each\ character\ that\ is\ in\ the\ ''splitChars''\ argument.\ \nEach\ element\ of\ the\ result\ list\ will\ consist\ of\ the\ characters\ from\ ''string''\ that\ lie\ between\ instances\ of\ the\ characters\ in\ ''splitChars''.\ \nEmpty\ list\ elements\ will\ be\ generated\ if\ ''string''\ contains\ adjacent\ characters\ in\ ''splitChars'',\ or\ if\ the\ first\ or\ last\ character\ of\ ''string''\ is\ in\ ''splitChars''.\ \nIf\ ''splitChars''\ is\ an\ empty\ string\ then\ each\ character\ of\ ''string''\ becomes\ a\ separate\ element\ of\ the\ result\ list.\ \n\nThe\ result\ of\ `split`\ is\ a\ list\ of\ substrings\ of\ ''string''\ that\ are\ delimitied\nSee\ the\ man\ page\ at\ http://www.tcl.tk/man/tcl8.5/TclCmd/split.htm\n\n\n\ \ \ \[join\]:\ \ \ \n\n\ \ \ \[list\]:\ \ \ \n\n\ \ \ \[Additional\ string\ functions\]:\ \ \ \n\ \ \ \n\ \ \ \[Arts\ and\ crafts\ of\ Tcl-Tk\ programming\]:\ \ \ \n\n\ \ \ \[ycl\]:\ \ \ provides\ `string\ delimit`,\ which\ splits\ strings\ on\ `\[string\ match\]`-style\ patterns\ or\ `\[regexp\]`-style\ patterns\n\ \ \ \[ycl\]:\ \ \ provides\ \[\[`string\ delimit`\],\ which\ splits\ strings\ on\ \[\[`\[string\ match\]`\]-style\ patterns\ or\ \[\[`\[regexp\]`\]-style\ patterns\n\ \ \ \[Splitting\ strings\ with\ embedded\ strings\]:\ \ \ \n\ \ \ \[Splitting\ a\ string\ on\ arbitrary\ substrings\]:\ \ \ \n\n***\ Splitting\ by\ dots\ ***\n----\nsplit\ comp.unix.misc\ .\nsplit\ \"comp.unix.misc\"\ .\n\n======none\ncomp\ unix\ misc\n======\n\n----\n***\ Splitting\ into\ characters\ ***\nsplit\ \{Hello\ world\}\ \{\}\nsplit\ \"Hello\ world\"\ \{\}\n\n======none\nH\ e\ l\ l\ o\ \{\ \}\ w\ o\ r\ l\ d\n======\n\nSplitting\ on\ the\ empty\ string\ is\ an\ optimized\ case,\ and\ is\ an\ efficient\n\n**\ Questions\ **\n\n\ \ \ *\ \[Splitting\ strings\ with\ embedded\ strings\]\n\n<<discussion>>\n**\ Definition\ of\ White-Space\ Characters\ **\n\n\[DKF\]:\ I\ believe\ there's\ a\ standard\ (ANSI?\ POSIX?)\ somewhere.\ \ But\ the\ answer\n\[DKF\]:\ I\ believe\ there's\ a\ standard\ (ANSI?\ POSIX?)\ somewhere.\ \ \nBut\ the\ answer\ includes\ \"space\",\ \"tab\",\ and\ \"newline\".\n\[escargo\]:\ By\ \"tab\"\ do\ you\ mean\ both\ horizontal\ tab\ (ASCII\ 9)\ and\ vertical\ tab\n''\[escargo\]''\ -\ By\ \"tab\"\ do\ you\ mean\ both\ horizontal\ tab\ (ASCII\ 9)\ and\ \nvertical\ tab\ (ASCII\ 11)?\ \ (See\ http://www.asciitable.com/)\ \ \nArguments\ could\ be\ made\ for\ most\ of\ the\ ASCII\ characters\ under\ 33.\n\[Strick\]:\ Let's\ ask\ Tcl\ what\ it\ thinks\ are\ white:\n\n\$\ env\ |\ grep\ en_\nLANG=en_US.UTF-8\n\$\ cat\ what-chars-does-split-think-are-white.tcl\nfor\ \{set\ i\ 0\}\ \{\$i<65536\}\ \{incr\ i\}\ \{\n\ \ if\ \{\[llength\ \[format\ \"/%c/\"\ \$i\]\]\ >\ 1\}\ \{\ puts\ -nonewline\ \"\$i\ \"\ \}\n\}\n\$\ tclsh\ what-chars-does-split-think-are-white.tcl\n9\ 10\ 11\ 12\ 13\ 32\ \$\n======\n\n\[escargo\]\ 2005-04-01\ :\n''\[escargo\]\ 4\ Jan\ 2005''\ -\n9\ =\ ASCII\ TAB,\ 10\ =\ ASCII\ LF\ (line\ feed),\ 11\ =\ ASCII\ VT\ (vertical\ tab),\ \n12\ =\ ASCII\ FF\ (form\ feed),\ 13\ =\ ASCII\ CR\ (carriage\ return),\ and\ of\ course\ 32\ =\ ASCII\ Space.\n9\ =\ ASCII\ TAB,\ 10\ =\ ASCII\ LF\ (line\ feed),\ 11\ =\ ASCII\ VT\ (vertical\ tab),\ 12\ =\nI\ would\ have\ thought\ that\ the\ separator\ characters\ would\ count\ as\ white\ space\ (28-31,\ \nFS,\ GS,\ RS,\ US),\ but\ I\ guess\ they\ are\ regarded\ as\ \"nonprinting\"\ characters.\nI\ would\ have\ thought\ that\ the\ separator\ characters\ would\ count\ as\ white\ space\n\n\[Strick\]:\ Oops,\ i\ forgot\ to\ actually\ use\ split\ in\ my\ script\ above.\ \ So\ now\ I\n\[Strick\]:\ Oops,\ i\ forgot\ to\ actually\ use\ split\ in\ my\ script\ above.\ \ \nSo\ now\ I\ test\ four\ different\ notions\ of\ white,\ and\ get\ three\ different\ answers.\nI\ understand\ why\ Tcl's\ builtin\ list-splitting\ rules\ must\ be\ fixed,\ regardless\ of\ locale.\nBut\ it\ seems\ 'split'\ should\ use\ the\ list-splitting\ rule\ or\ the\ the\ 'string\ is\ space'\ rule,\ \nbut\ it\ uses\ its\ own\ (pre-unicode?)\ rule:\n\$\ cat\ what-chars-does-split-think-are-white.tcl\nputs\ \"tcl=\[info\ patch\]\ LANG=\$env(LANG)\"\n\nputs\ -nonewline\ \{according\ to\ llength:\ \}\nputs\ -nonewline\ \"according\ to\ llength:\ \"\n\ \ if\ \{\[llength\ \[format\ \"/%c/\"\ \$i\]\]\ >\ 1\}\ \{\ puts\ -nonewline\ \"\$i\ \"\ \}\n\}\nputs\ \{\}\ \nputs\ \"\"\nputs\ -nonewline\ \{according\ to\ split:\ \}\nputs\ -nonewline\ \"according\ to\ split:\ \"\nfor\ \{set\ i\ 0\}\ \{\$i<65536\}\ \{incr\ i\}\ \{\n\ \ if\ \{\[llength\ \[split\ \[format\ \"/%c/\"\ \$i\]\]\]\ >\ 1\}\ \{\ puts\ -nonewline\ \"\$i\ \"\ \}\nputs\ \{\}\ \nputs\ \"\"\nputs\ -nonewline\ \{according\ to\ 'string\ is\ space':\ \}\nputs\ -nonewline\ \"according\ to\ 'string\ is\ space':\ \"\nfor\ \{set\ i\ 0\}\ \{\$i<65536\}\ \{incr\ i\}\ \{\n\ \ if\ \{\[string\ is\ space\ \[format\ \"%c\"\ \$i\]\]\}\ \{\ puts\ -nonewline\ \"\$i\ \"\ \}\nputs\ \{\}\ \nputs\ \"\"\nputs\ -nonewline\ \{according\ to\ regexp\ \{\\s\}:\ \}\nputs\ -nonewline\ \"according\ to\ regexp\ \{\\\\s\}:\ \"\nfor\ \{set\ i\ 0\}\ \{\$i<65536\}\ \{incr\ i\}\ \{\n\}\nputs\ \{\}\nputs\ \"\"\n\$\n\$\ tclsh\ what-chars-does-split-think-are-white.tcl\ntcl=8.4.7\ LANG=en_US.UTF-8\naccording\ to\ llength:\ 9\ 10\ 11\ 12\ 13\ 32\naccording\ to\ split:\ 9\ 10\ 13\ 32\naccording\ to\ 'string\ is\ space':\ 9\ 10\ 11\ 12\ 13\ 32\ 160\ 5760\ 8192\ 8193\ 8194\ 8195\ 8196\ 8197\ 8198\ 8199\ 8200\ 8201\ 8202\ 8203\ 8232\ 8233\ 8239\ 12288\naccording\ to\ regexp\ \{\\s\}:\ 9\ 10\ 11\ 12\ 13\ 32\ 160\ 5760\ 8192\ 8193\ 8194\ 8195\ 8196\ 8197\ 8198\ 8199\ 8200\ 8201\ 8202\ 8203\ 8232\ 8233\ 8239\ 12288\n\$\n======\n\n\[escargo\]\ 2006-01-27:\ If\ split\ used\ chars\ 9\ 10\ 11\ 12\ 13\ 32\ then\ there\ would\ be\n''\[escargo\]\ 27\ Jan\ 2006''\ -\ If\ split\ used\ chars\ 9\ 10\ 11\ 12\ 13\ 32\ then\ there\ would\ be\ only\ two\ sets,\ with\ the\ smaller\ set\ as\ a\ proper\ subset\ of\ the\ larger\ set.\ \ \nThe\ two\ characters\ that\ would\ have\ to\ be\ added\ are\ the\ vertical\ tab\ and\ form\ feed.\n----\nNote\ that\ the\ argument\ named\ ''splitChars''\ above\ is\ a\ series\ of\ 0\ to\ n\ individual\ characters.\ \ \nHowever,\ if\ you\ want\ to\ split\ on\ a\ specific\ sequence\ of\ 2\ or\ more\ characters\ together,\ \nor\ if\ you\ want\ to\ split\ on\ a\ regular\ expression,\ split\ will\ not\ work\ for\ you.\ \ \nSee\ \[Tcllib\]'s\ \[textutil\]::\[splitx\]\ for\ that\ functionality.\n\n\[SS\]\ 2004/01/31\ -\ or\ you\ can\ use\ the\ following\ function:\nproc\ wsplit\ \{string\ sep\}\ \{\n\ \ \ \ set\ first\ \[string\ first\ \$sep\ \$string\]\n\ \ \ \ if\ \{\$first\ ==\ -1\}\ \{\n\ \ \ \ \ \ \ \ return\ \[list\ \$string\]\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ set\ l\ \[string\ length\ \$sep\]\n\ \ \ \ \ \ \ \ set\ left\ \[string\ range\ \$string\ 0\ \[expr\ \{\$first-1\}\]\]\n\ \ \ \ \ \ \ \ set\ right\ \[string\ range\ \$string\ \[expr\ \{\$first+\$l\}\]\ end\]\n\ \ \ \ \ \ \ \ return\ \[concat\ \[list\ \$left\]\ \[wsplit\ \$right\ \$sep\]\]\n\ \ \ \ \}\n\}\n======\n\nThis\ version\ is\ recursive,\ so\ it\ may\ be\ better\ to\ rewrite\ it\ if\ you\ plan\ to\ use\nThis\ version\ is\ recursive,\ so\ it\ may\ be\ better\ to\ rewrite\ it\ if\ you\ plan\ to\ use\ the\ function\nagainst\ very\ long\ strings\ with\ many\ separators.\ The\ difference\ between\ wsplit\ and\ \[splitx\]\nis\ that\ \[splitx\]\ uses\ \[regexp\],\ so\ it\ may\ create\ problems\ with\ unknown\ separators.\n\[IL\]\ 2005-01-03:\ on\ the\ near\ anniversary\ of\ this\ proc,\ the\ iterative\ version,\n\[IL\]\ 2005/01/03\ -\ on\ the\ near\ anniversary\ of\ this\ proc,\ the\ iterative\ version,\ \nquick\ n\ dirty\ since\ I'm\ in\ a\ hurry\ to\ parse\ some\ html...\n======\nproc\ wsplit\ \{\ str\ sepStr\ \}\ \{\n\ \ \ set\ strList\ \ \ \{\}\n\n\ \ \ set\ strList\ \ \ \[list\]\n\n\ \ \ while\ \{\[set\ index\ \[string\ first\ \$sepStr\ \$str\]\]\ !=\ -1\}\ \{\n\ \ \ while\ \{\ \[set\ index\ \[string\ first\ \$sepStr\ \$str\]\]\ !=\ \"-1\"\ \}\ \{\n\n\ \ \ \ \ \ \ set\ left\ \[string\ range\ \$str\ 0\ \[expr\ \$index\ +\ \$sepLength\ -\ 1\]\]\n\ \ \ \ \ \ \ set\ str\ \ \[string\ range\ \$str\ \[expr\ \$index\ +\ \$sepLength\ +\ 1\]\ end\]\n\ \ \ \}\n\ \ \ return\ \$strList\n\n\}\n======\n\nconnected\ to\ the\ ones\ you\ want\ \n\nproc\ wsplit\ \{str\ sepStr\}\ \{\nproc\ wsplit\ \{\ str\ sepStr\ \}\ \{\n\n\ \ \ if\ \{\ !\[regexp\ \$sepStr\ \$str\]\ \}\ \{\ return\ \$str\ \}\n\n\ \ \ set\ strList\ \ \ \[list\]\n\n\ \ \ set\ pattern\ \"(.*?)\$sepStr\"\n\ \ \ while\ \{\ \[regexp\ \$pattern\ \$str\ match\ left\]\ \}\ \{\n\n\ \ \ \ \ \ \ lappend\ strList\ \$left\n\ \ \ \ \ \ \ regsub\ \$pattern\ \$str\ \"\"\ str\n\ \ \ \}\n\ \ \ \ \n\ \ \ lappend\ strList\ \$str\n\n\ \ \ return\ \$strList\n======\n\n\[RS\]\ writes\ recently:\n\nNote\ that\ the\ wsplit\ can\ be\ done\ simpler:\n\n\ \ \ \ 2.\ split\ on\ that\ single\ char\n\nproc\ wsplit\ \{str\ sep\}\ \{\n\ \ split\ \[string\ map\ \[list\ \$sep\ \\0\]\ \$str\]\ \\0\n\}\n%\ wsplit\ This<>is<>a<>test.\ <>\nThis\ is\ a\ test.\n======\n\n----\n\n''2006-06-21''\ \[Sarnold\]\ Here\ is\ my\ version\ of\ wsplit:\nproc\ wsplit\ \{str\ sep\}\ \{\n\ \ \ \ set\ out\ \{\}\ \n\ \ \ \ set\ out\ \"\"\n\ \ \ \ if\ \{\$sepLen\ <\ 2\}\ \{\n\ \ \ \ if\ \{\$sepLen\ <2\}\ \{\n\ \ \ \ \}\n\ \ \ \ while\ \{\[set\ idx\ \[string\ first\ \$sep\ \$str\]\]\ >=\ 0\}\ \{\n\ \ \ \ \ \ \ \ #\ the\ left\ part\ :\ the\ current\ element\n\ \ \ \ \ \ \ \ if\ \{\$idx>=0\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ #\ the\ left\ part\ :\ the\ current\ element\n\ \ \ \ \ \ \ \ \ \ \ \ lappend\ out\ \[string\ range\ \$str\ 0\ \[expr\ \{\$idx-1\}\]\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ set\ str\ \[string\ range\ \$str\ \[incr\ idx\ \$sepLen\]\ end\]\n\ \ \ \ \}\n\ \ \ \ #\ there\ is\ no\ separator\ anymore,\ but\ keep\ in\ mind\ the\ right\ part\ must\ be\n\ \ \ \ #\ there\ is\ no\ separator\ anymore,\ but\ keep\ in\ mind\ the\ right\ part\ must\ be\ appended\n\}\n======\n\n----\n\n\[escargo\]:\ So\ what\ should\ you\ use\ when\ you\ don't\ care\ how\ many\ spaces\ were\nSo\ what\ should\ you\ use\ when\ you\ don't\ care\ how\ many\ spaces\ were\ between\ tokens,\nyou\ just\ want\ the\ nonblank\ tokens\ in\ the\ list\ and\ none\ of\ the\ separators?\n''--\ \[escargo\]''\n\[RS\]:\ Easy,\ just\ use\ a\ filter:\n\nproc\ filter\ \{cond\ list\}\ \{\n\ \ \ \ set\ res\ \{\}\n\ \ \ set\ res\ \{\}\n\ \ \ foreach\ element\ \$list\ \{if\ \[\$cond\ \$element\]\ \{lappend\ res\ \$element\}\}\n\ \ \ set\ res\n%\ filter\ llength\ \[split\ \"a\ \ \ list\ \ \ with\ many\ \ \ spaces\"\]\na\ list\ with\ many\ spaces\n======\n\n...\ or\ use\n\n%\ split\ \[regsub\ -all\ \{\[\ \\t\\n\]+\}\ \"a\ \ \ list\ \ \ with\ many\ \ \ spaces\"\ \{\ \}\]\ \n======\n\n\n...\ or\ use\ \n\n%\ lreplace\ \"a\ \ \ list\ \ \ with\ many\ \ \ spaces\"\ 0\ -1\n======\n\n\n\n----\nSee\ \[Counting\ characters\ in\ a\ string\]\ where\ \[split\]\ was\ pretty\ good...\n----\nKaitzschu\ mentions,\ on\ \[comp.lang.tcl\],\ this\ piece\ of\ info\ \nwhich\ is\ supposedly\ somewhere\ in\ the\ man\ pages:\n\n\"If\ splitChars\ is\ an\ empty\ string\ then\ each\ character\ of\ string\ \nbecomes\ a\ separate\ element\ of\ the\ result\ list.\"\ \n======\nThus,\ \nproc\ hexdump\ str\ \{\ \nset\ l\ \[split\ \{abcdefghijklmnopqrstuvwxyz\}\ \{\}\]\n======\nresults\ in\ a\ list\ where\ each\ character\ is\ turned\ into\ a\ separate\ list\ entry.\n----\n\[RS\]\ 2006-07-04:\ When\ you\ split\ on\ \"\"\ on\ a\ byte\ array,\ it\ may\ be\ surprising\ that\ the\ result\ may\ contain\ un\[scan\]nable\ characters\ for\ \\x00\ bytes.\ I\ had\ to\ work\ around\ like\ this:\n======\n\ \ \ \ set\ res\ \{\}\ \n\ \ set\ res\ \{\}\ \n\ \ foreach\ c\ \[split\ \$str\ \"\"\]\ \{\ \n\ \ \ \ \ set\ i\ \[scan\ \$c\ %c\]\ \n\ \ \ \ \ if\ \{\$i\ eq\ \"\"\}\ \{set\ i\ 0\}\ \;#<---------------------\ here\ \n\ \ \ \ \ lappend\ res\ \[format\ %02x\ \$i\]\ \n\ \ \}\ \n\ \ set\ res\ \n======\n\n**\ Protecting\ Separators\ **\n\n''\[escargo\]\ 18\ Jun\ 2007''\ -\ (We\ seem\ to\ have\ some\ edits\ getting\ lost\;\ I'm\ putting\ this\ back\ in\nsince\ it\ seems\ to\ have\ disappeared.)\ \ I\ was\ realizing\ that\ then\ I\ was\ writing\ a\ ''little\ language''\nthat\ there\ doesn't\ seem\ to\ be\ a\ Tcl\ command\ that\ returns\ a\ list\ made\ from\ breaking\ up\ a\ string\ as\nthe\ command\ parser\ would.\ \ \[split\]\ doesn't\ do\ it.\ \ It\ made\ me\ think\ how\ \[subst\]\ has\ arguments\ that\ndisable\ command\ substitution\ and\ variable\ substitution,\ while\ \[eval\]\ does\ not.\ There\ are\ commands\nlike\ \[eval\],\ \[info\ complete\],\ '''string\ is\ list'''\ that\ appear\ to\ do\ the\ tokenization,\ but\ the\ tokenized\ results\ are\nnot\ accessible\ to\ the\ script\ level.\ Is\ there\ some\ way\ (apparently\ not\ obvious\ to\ me)\ to\ get\ the\nlist\ form\ out\ of\ the\ string?\n\[PYK\]\ 2014-03-02:\ There\ was\ previously\ a\ discussion\ by\ \[escargo\]\ here\ that\ made\n\[MG\]\ Tcl\ 8.5's\ \[\{*\}\]\ expansion\ is\ probably\ the\ easiest\ way.\ In\ 8.4\ you'd\ probably\ need\ to\ use\ \[eval\],\ which\ would\ mean\ a\ lot\ of\ work\ to\ escape\ special\ characters,\ make\ sure\ things\ that\ the\ parser\ would\ see\ as\ one\ word,\ such\ as\n======\n\[string\ is\ int\ \$foo\]\n======\nbecome\n======\ \n\"\[string\ is\ int\ \$foo\]\"\n======\nso\ the\ eval\ doesn't\ split\ it\ into\ separate\ words,\ etc.\ It\ would\ be\ possible,\ I\ imagine,\ but\ a\ bit\ of\ a\ pain\ to\ do,\ compared\ to\ something\ like\n======\nproc\ str2list\ \{args\}\ \{\n\ \ return\ \$args\n\}\nset\ list\ \[str2list\ \{*\}\$string\]\n======\nin\ 8.5.\n<<categories>>\ Command\ |\ String\ Processing\n''\[escargo\]''\ -\ Reading\ the\ original\ TIP\ for\ \{expand\},\ it\ appears\ that\ it\ was\ intended\ to\ expand\na\ list\ into\ separate\ items\ for\ processing.\ \ So,\ using\ \{*\}\ as\ you\ did\ is\ working\ around\ the\ fact\nthat\ something\ is\ taking\ \$string\ and\ tokenizing\ it,\ treating\ the\ result\ as\ a\ list,\ and\ passing\ it\nto\ \{*\}\ to\ expand.\ \ Again,\ it\ seems,\ the\ tokenizing\ is\ buried\ where\ it\ is\ not\ accessible\ to\ a\ script.\n\nIt\ really\ seems\ like\ there\ ought\ to\ be\ a\ way.\ \ Right\ now\ split\ doesn't\ take\ any\ control\ arguments,\nso\ that\ '''\[\[split\ -tokens\ \$string\]\]'''\ wouldn't\ break\ any\ code.\n\n<<discussion>>\n\n<<categories>>\ Tcl\ syntax\ help\ |\ Command\ |\ String\ Processing regexp2} CALL {my render split split\ -\ Split\ a\ string\ into\ a\ proper\ Tcl\ list\n\n\n\nReturns\ a\ list\ created\ by\ splitting\ ''string''\ at\ each\ character\ that\ is\ in\ the\ ''splitChars''\ argument.\ \nEach\ element\ of\ the\ result\ list\ will\ consist\ of\ the\ characters\ from\ ''string''\ that\ lie\ between\ instances\ of\ the\ characters\ in\ ''splitChars''.\ \nEmpty\ list\ elements\ will\ be\ generated\ if\ ''string''\ contains\ adjacent\ characters\ in\ ''splitChars'',\ or\ if\ the\ first\ or\ last\ character\ of\ ''string''\ is\ in\ ''splitChars''.\ \nIf\ ''splitChars''\ is\ an\ empty\ string\ then\ each\ character\ of\ ''string''\ becomes\ a\ separate\ element\ of\ the\ result\ list.\ \n\nThe\ result\ of\ `split`\ is\ a\ list\ of\ substrings\ of\ ''string''\ that\ are\ delimitied\nSee\ the\ man\ page\ at\ http://www.tcl.tk/man/tcl8.5/TclCmd/split.htm\n\n\n\ \ \ \[join\]:\ \ \ \n\n\ \ \ \[list\]:\ \ \ \n\n\ \ \ \[Additional\ string\ functions\]:\ \ \ \n\ \ \ \n\ \ \ \[Arts\ and\ crafts\ of\ Tcl-Tk\ programming\]:\ \ \ \n\n\ \ \ \[ycl\]:\ \ \ provides\ `string\ delimit`,\ which\ splits\ strings\ on\ `\[string\ match\]`-style\ patterns\ or\ `\[regexp\]`-style\ patterns\n\ \ \ \[ycl\]:\ \ \ provides\ \[\[`string\ delimit`\],\ which\ splits\ strings\ on\ \[\[`\[string\ match\]`\]-style\ patterns\ or\ \[\[`\[regexp\]`\]-style\ patterns\n\ \ \ \[Splitting\ strings\ with\ embedded\ strings\]:\ \ \ \n\ \ \ \[Splitting\ a\ string\ on\ arbitrary\ substrings\]:\ \ \ \n\n***\ Splitting\ by\ dots\ ***\n----\nsplit\ comp.unix.misc\ .\nsplit\ \"comp.unix.misc\"\ .\n\n======none\ncomp\ unix\ misc\n======\n\n----\n***\ Splitting\ into\ characters\ ***\nsplit\ \{Hello\ world\}\ \{\}\nsplit\ \"Hello\ world\"\ \{\}\n\n======none\nH\ e\ l\ l\ o\ \{\ \}\ w\ o\ r\ l\ d\n======\n\nSplitting\ on\ the\ empty\ string\ is\ an\ optimized\ case,\ and\ is\ an\ efficient\n\n**\ Questions\ **\n\n\ \ \ *\ \[Splitting\ strings\ with\ embedded\ strings\]\n\n<<discussion>>\n**\ Definition\ of\ White-Space\ Characters\ **\n\n\[DKF\]:\ I\ believe\ there's\ a\ standard\ (ANSI?\ POSIX?)\ somewhere.\ \ But\ the\ answer\n\[DKF\]:\ I\ believe\ there's\ a\ standard\ (ANSI?\ POSIX?)\ somewhere.\ \ \nBut\ the\ answer\ includes\ \"space\",\ \"tab\",\ and\ \"newline\".\n\[escargo\]:\ By\ \"tab\"\ do\ you\ mean\ both\ horizontal\ tab\ (ASCII\ 9)\ and\ vertical\ tab\n''\[escargo\]''\ -\ By\ \"tab\"\ do\ you\ mean\ both\ horizontal\ tab\ (ASCII\ 9)\ and\ \nvertical\ tab\ (ASCII\ 11)?\ \ (See\ http://www.asciitable.com/)\ \ \nArguments\ could\ be\ made\ for\ most\ of\ the\ ASCII\ characters\ under\ 33.\n\[Strick\]:\ Let's\ ask\ Tcl\ what\ it\ thinks\ are\ white:\n\n\$\ env\ |\ grep\ en_\nLANG=en_US.UTF-8\n\$\ cat\ what-chars-does-split-think-are-white.tcl\nfor\ \{set\ i\ 0\}\ \{\$i<65536\}\ \{incr\ i\}\ \{\n\ \ if\ \{\[llength\ \[format\ \"/%c/\"\ \$i\]\]\ >\ 1\}\ \{\ puts\ -nonewline\ \"\$i\ \"\ \}\n\}\n\$\ tclsh\ what-chars-does-split-think-are-white.tcl\n9\ 10\ 11\ 12\ 13\ 32\ \$\n======\n\n\[escargo\]\ 2005-04-01\ :\n''\[escargo\]\ 4\ Jan\ 2005''\ -\n9\ =\ ASCII\ TAB,\ 10\ =\ ASCII\ LF\ (line\ feed),\ 11\ =\ ASCII\ VT\ (vertical\ tab),\ \n12\ =\ ASCII\ FF\ (form\ feed),\ 13\ =\ ASCII\ CR\ (carriage\ return),\ and\ of\ course\ 32\ =\ ASCII\ Space.\n9\ =\ ASCII\ TAB,\ 10\ =\ ASCII\ LF\ (line\ feed),\ 11\ =\ ASCII\ VT\ (vertical\ tab),\ 12\ =\nI\ would\ have\ thought\ that\ the\ separator\ characters\ would\ count\ as\ white\ space\ (28-31,\ \nFS,\ GS,\ RS,\ US),\ but\ I\ guess\ they\ are\ regarded\ as\ \"nonprinting\"\ characters.\nI\ would\ have\ thought\ that\ the\ separator\ characters\ would\ count\ as\ white\ space\n\n\[Strick\]:\ Oops,\ i\ forgot\ to\ actually\ use\ split\ in\ my\ script\ above.\ \ So\ now\ I\n\[Strick\]:\ Oops,\ i\ forgot\ to\ actually\ use\ split\ in\ my\ script\ above.\ \ \nSo\ now\ I\ test\ four\ different\ notions\ of\ white,\ and\ get\ three\ different\ answers.\nI\ understand\ why\ Tcl's\ builtin\ list-splitting\ rules\ must\ be\ fixed,\ regardless\ of\ locale.\nBut\ it\ seems\ 'split'\ should\ use\ the\ list-splitting\ rule\ or\ the\ the\ 'string\ is\ space'\ rule,\ \nbut\ it\ uses\ its\ own\ (pre-unicode?)\ rule:\n\$\ cat\ what-chars-does-split-think-are-white.tcl\nputs\ \"tcl=\[info\ patch\]\ LANG=\$env(LANG)\"\n\nputs\ -nonewline\ \{according\ to\ llength:\ \}\nputs\ -nonewline\ \"according\ to\ llength:\ \"\n\ \ if\ \{\[llength\ \[format\ \"/%c/\"\ \$i\]\]\ >\ 1\}\ \{\ puts\ -nonewline\ \"\$i\ \"\ \}\n\}\nputs\ \{\}\ \nputs\ \"\"\nputs\ -nonewline\ \{according\ to\ split:\ \}\nputs\ -nonewline\ \"according\ to\ split:\ \"\nfor\ \{set\ i\ 0\}\ \{\$i<65536\}\ \{incr\ i\}\ \{\n\ \ if\ \{\[llength\ \[split\ \[format\ \"/%c/\"\ \$i\]\]\]\ >\ 1\}\ \{\ puts\ -nonewline\ \"\$i\ \"\ \}\nputs\ \{\}\ \nputs\ \"\"\nputs\ -nonewline\ \{according\ to\ 'string\ is\ space':\ \}\nputs\ -nonewline\ \"according\ to\ 'string\ is\ space':\ \"\nfor\ \{set\ i\ 0\}\ \{\$i<65536\}\ \{incr\ i\}\ \{\n\ \ if\ \{\[string\ is\ space\ \[format\ \"%c\"\ \$i\]\]\}\ \{\ puts\ -nonewline\ \"\$i\ \"\ \}\nputs\ \{\}\ \nputs\ \"\"\nputs\ -nonewline\ \{according\ to\ regexp\ \{\\s\}:\ \}\nputs\ -nonewline\ \"according\ to\ regexp\ \{\\\\s\}:\ \"\nfor\ \{set\ i\ 0\}\ \{\$i<65536\}\ \{incr\ i\}\ \{\n\}\nputs\ \{\}\nputs\ \"\"\n\$\n\$\ tclsh\ what-chars-does-split-think-are-white.tcl\ntcl=8.4.7\ LANG=en_US.UTF-8\naccording\ to\ llength:\ 9\ 10\ 11\ 12\ 13\ 32\naccording\ to\ split:\ 9\ 10\ 13\ 32\naccording\ to\ 'string\ is\ space':\ 9\ 10\ 11\ 12\ 13\ 32\ 160\ 5760\ 8192\ 8193\ 8194\ 8195\ 8196\ 8197\ 8198\ 8199\ 8200\ 8201\ 8202\ 8203\ 8232\ 8233\ 8239\ 12288\naccording\ to\ regexp\ \{\\s\}:\ 9\ 10\ 11\ 12\ 13\ 32\ 160\ 5760\ 8192\ 8193\ 8194\ 8195\ 8196\ 8197\ 8198\ 8199\ 8200\ 8201\ 8202\ 8203\ 8232\ 8233\ 8239\ 12288\n\$\n======\n\n\[escargo\]\ 2006-01-27:\ If\ split\ used\ chars\ 9\ 10\ 11\ 12\ 13\ 32\ then\ there\ would\ be\n''\[escargo\]\ 27\ Jan\ 2006''\ -\ If\ split\ used\ chars\ 9\ 10\ 11\ 12\ 13\ 32\ then\ there\ would\ be\ only\ two\ sets,\ with\ the\ smaller\ set\ as\ a\ proper\ subset\ of\ the\ larger\ set.\ \ \nThe\ two\ characters\ that\ would\ have\ to\ be\ added\ are\ the\ vertical\ tab\ and\ form\ feed.\n----\nNote\ that\ the\ argument\ named\ ''splitChars''\ above\ is\ a\ series\ of\ 0\ to\ n\ individual\ characters.\ \ \nHowever,\ if\ you\ want\ to\ split\ on\ a\ specific\ sequence\ of\ 2\ or\ more\ characters\ together,\ \nor\ if\ you\ want\ to\ split\ on\ a\ regular\ expression,\ split\ will\ not\ work\ for\ you.\ \ \nSee\ \[Tcllib\]'s\ \[textutil\]::\[splitx\]\ for\ that\ functionality.\n\n\[SS\]\ 2004/01/31\ -\ or\ you\ can\ use\ the\ following\ function:\nproc\ wsplit\ \{string\ sep\}\ \{\n\ \ \ \ set\ first\ \[string\ first\ \$sep\ \$string\]\n\ \ \ \ if\ \{\$first\ ==\ -1\}\ \{\n\ \ \ \ \ \ \ \ return\ \[list\ \$string\]\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ set\ l\ \[string\ length\ \$sep\]\n\ \ \ \ \ \ \ \ set\ left\ \[string\ range\ \$string\ 0\ \[expr\ \{\$first-1\}\]\]\n\ \ \ \ \ \ \ \ set\ right\ \[string\ range\ \$string\ \[expr\ \{\$first+\$l\}\]\ end\]\n\ \ \ \ \ \ \ \ return\ \[concat\ \[list\ \$left\]\ \[wsplit\ \$right\ \$sep\]\]\n\ \ \ \ \}\n\}\n======\n\nThis\ version\ is\ recursive,\ so\ it\ may\ be\ better\ to\ rewrite\ it\ if\ you\ plan\ to\ use\nThis\ version\ is\ recursive,\ so\ it\ may\ be\ better\ to\ rewrite\ it\ if\ you\ plan\ to\ use\ the\ function\nagainst\ very\ long\ strings\ with\ many\ separators.\ The\ difference\ between\ wsplit\ and\ \[splitx\]\nis\ that\ \[splitx\]\ uses\ \[regexp\],\ so\ it\ may\ create\ problems\ with\ unknown\ separators.\n\[IL\]\ 2005-01-03:\ on\ the\ near\ anniversary\ of\ this\ proc,\ the\ iterative\ version,\n\[IL\]\ 2005/01/03\ -\ on\ the\ near\ anniversary\ of\ this\ proc,\ the\ iterative\ version,\ \nquick\ n\ dirty\ since\ I'm\ in\ a\ hurry\ to\ parse\ some\ html...\n======\nproc\ wsplit\ \{\ str\ sepStr\ \}\ \{\n\ \ \ set\ strList\ \ \ \{\}\n\n\ \ \ set\ strList\ \ \ \[list\]\n\n\ \ \ while\ \{\[set\ index\ \[string\ first\ \$sepStr\ \$str\]\]\ !=\ -1\}\ \{\n\ \ \ while\ \{\ \[set\ index\ \[string\ first\ \$sepStr\ \$str\]\]\ !=\ \"-1\"\ \}\ \{\n\n\ \ \ \ \ \ \ set\ left\ \[string\ range\ \$str\ 0\ \[expr\ \$index\ +\ \$sepLength\ -\ 1\]\]\n\ \ \ \ \ \ \ set\ str\ \ \[string\ range\ \$str\ \[expr\ \$index\ +\ \$sepLength\ +\ 1\]\ end\]\n\ \ \ \}\n\ \ \ return\ \$strList\n\n\}\n======\n\nconnected\ to\ the\ ones\ you\ want\ \n\nproc\ wsplit\ \{str\ sepStr\}\ \{\nproc\ wsplit\ \{\ str\ sepStr\ \}\ \{\n\n\ \ \ if\ \{\ !\[regexp\ \$sepStr\ \$str\]\ \}\ \{\ return\ \$str\ \}\n\n\ \ \ set\ strList\ \ \ \[list\]\n\n\ \ \ set\ pattern\ \"(.*?)\$sepStr\"\n\ \ \ while\ \{\ \[regexp\ \$pattern\ \$str\ match\ left\]\ \}\ \{\n\n\ \ \ \ \ \ \ lappend\ strList\ \$left\n\ \ \ \ \ \ \ regsub\ \$pattern\ \$str\ \"\"\ str\n\ \ \ \}\n\ \ \ \ \n\ \ \ lappend\ strList\ \$str\n\n\ \ \ return\ \$strList\n======\n\n\[RS\]\ writes\ recently:\n\nNote\ that\ the\ wsplit\ can\ be\ done\ simpler:\n\n\ \ \ \ 2.\ split\ on\ that\ single\ char\n\nproc\ wsplit\ \{str\ sep\}\ \{\n\ \ split\ \[string\ map\ \[list\ \$sep\ \\0\]\ \$str\]\ \\0\n\}\n%\ wsplit\ This<>is<>a<>test.\ <>\nThis\ is\ a\ test.\n======\n\n----\n\n''2006-06-21''\ \[Sarnold\]\ Here\ is\ my\ version\ of\ wsplit:\nproc\ wsplit\ \{str\ sep\}\ \{\n\ \ \ \ set\ out\ \{\}\ \n\ \ \ \ set\ out\ \"\"\n\ \ \ \ if\ \{\$sepLen\ <\ 2\}\ \{\n\ \ \ \ if\ \{\$sepLen\ <2\}\ \{\n\ \ \ \ \}\n\ \ \ \ while\ \{\[set\ idx\ \[string\ first\ \$sep\ \$str\]\]\ >=\ 0\}\ \{\n\ \ \ \ \ \ \ \ #\ the\ left\ part\ :\ the\ current\ element\n\ \ \ \ \ \ \ \ if\ \{\$idx>=0\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ #\ the\ left\ part\ :\ the\ current\ element\n\ \ \ \ \ \ \ \ \ \ \ \ lappend\ out\ \[string\ range\ \$str\ 0\ \[expr\ \{\$idx-1\}\]\]\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ set\ str\ \[string\ range\ \$str\ \[incr\ idx\ \$sepLen\]\ end\]\n\ \ \ \ \}\n\ \ \ \ #\ there\ is\ no\ separator\ anymore,\ but\ keep\ in\ mind\ the\ right\ part\ must\ be\n\ \ \ \ #\ there\ is\ no\ separator\ anymore,\ but\ keep\ in\ mind\ the\ right\ part\ must\ be\ appended\n\}\n======\n\n----\n\n\[escargo\]:\ So\ what\ should\ you\ use\ when\ you\ don't\ care\ how\ many\ spaces\ were\nSo\ what\ should\ you\ use\ when\ you\ don't\ care\ how\ many\ spaces\ were\ between\ tokens,\nyou\ just\ want\ the\ nonblank\ tokens\ in\ the\ list\ and\ none\ of\ the\ separators?\n''--\ \[escargo\]''\n\[RS\]:\ Easy,\ just\ use\ a\ filter:\n\nproc\ filter\ \{cond\ list\}\ \{\n\ \ \ \ set\ res\ \{\}\n\ \ \ set\ res\ \{\}\n\ \ \ foreach\ element\ \$list\ \{if\ \[\$cond\ \$element\]\ \{lappend\ res\ \$element\}\}\n\ \ \ set\ res\n%\ filter\ llength\ \[split\ \"a\ \ \ list\ \ \ with\ many\ \ \ spaces\"\]\na\ list\ with\ many\ spaces\n======\n\n...\ or\ use\n\n%\ split\ \[regsub\ -all\ \{\[\ \\t\\n\]+\}\ \"a\ \ \ list\ \ \ with\ many\ \ \ spaces\"\ \{\ \}\]\ \n======\n\n\n...\ or\ use\ \n\n%\ lreplace\ \"a\ \ \ list\ \ \ with\ many\ \ \ spaces\"\ 0\ -1\n======\n\n\n\n----\nSee\ \[Counting\ characters\ in\ a\ string\]\ where\ \[split\]\ was\ pretty\ good...\n----\nKaitzschu\ mentions,\ on\ \[comp.lang.tcl\],\ this\ piece\ of\ info\ \nwhich\ is\ supposedly\ somewhere\ in\ the\ man\ pages:\n\n\"If\ splitChars\ is\ an\ empty\ string\ then\ each\ character\ of\ string\ \nbecomes\ a\ separate\ element\ of\ the\ result\ list.\"\ \n======\nThus,\ \nproc\ hexdump\ str\ \{\ \nset\ l\ \[split\ \{abcdefghijklmnopqrstuvwxyz\}\ \{\}\]\n======\nresults\ in\ a\ list\ where\ each\ character\ is\ turned\ into\ a\ separate\ list\ entry.\n----\n\[RS\]\ 2006-07-04:\ When\ you\ split\ on\ \"\"\ on\ a\ byte\ array,\ it\ may\ be\ surprising\ that\ the\ result\ may\ contain\ un\[scan\]nable\ characters\ for\ \\x00\ bytes.\ I\ had\ to\ work\ around\ like\ this:\n======\n\ \ \ \ set\ res\ \{\}\ \n\ \ set\ res\ \{\}\ \n\ \ foreach\ c\ \[split\ \$str\ \"\"\]\ \{\ \n\ \ \ \ \ set\ i\ \[scan\ \$c\ %c\]\ \n\ \ \ \ \ if\ \{\$i\ eq\ \"\"\}\ \{set\ i\ 0\}\ \;#<---------------------\ here\ \n\ \ \ \ \ lappend\ res\ \[format\ %02x\ \$i\]\ \n\ \ \}\ \n\ \ set\ res\ \n======\n\n**\ Protecting\ Separators\ **\n\n''\[escargo\]\ 18\ Jun\ 2007''\ -\ (We\ seem\ to\ have\ some\ edits\ getting\ lost\;\ I'm\ putting\ this\ back\ in\nsince\ it\ seems\ to\ have\ disappeared.)\ \ I\ was\ realizing\ that\ then\ I\ was\ writing\ a\ ''little\ language''\nthat\ there\ doesn't\ seem\ to\ be\ a\ Tcl\ command\ that\ returns\ a\ list\ made\ from\ breaking\ up\ a\ string\ as\nthe\ command\ parser\ would.\ \ \[split\]\ doesn't\ do\ it.\ \ It\ made\ me\ think\ how\ \[subst\]\ has\ arguments\ that\ndisable\ command\ substitution\ and\ variable\ substitution,\ while\ \[eval\]\ does\ not.\ There\ are\ commands\nlike\ \[eval\],\ \[info\ complete\],\ '''string\ is\ list'''\ that\ appear\ to\ do\ the\ tokenization,\ but\ the\ tokenized\ results\ are\nnot\ accessible\ to\ the\ script\ level.\ Is\ there\ some\ way\ (apparently\ not\ obvious\ to\ me)\ to\ get\ the\nlist\ form\ out\ of\ the\ string?\n\[PYK\]\ 2014-03-02:\ There\ was\ previously\ a\ discussion\ by\ \[escargo\]\ here\ that\ made\n\[MG\]\ Tcl\ 8.5's\ \[\{*\}\]\ expansion\ is\ probably\ the\ easiest\ way.\ In\ 8.4\ you'd\ probably\ need\ to\ use\ \[eval\],\ which\ would\ mean\ a\ lot\ of\ work\ to\ escape\ special\ characters,\ make\ sure\ things\ that\ the\ parser\ would\ see\ as\ one\ word,\ such\ as\n======\n\[string\ is\ int\ \$foo\]\n======\nbecome\n======\ \n\"\[string\ is\ int\ \$foo\]\"\n======\nso\ the\ eval\ doesn't\ split\ it\ into\ separate\ words,\ etc.\ It\ would\ be\ possible,\ I\ imagine,\ but\ a\ bit\ of\ a\ pain\ to\ do,\ compared\ to\ something\ like\n======\nproc\ str2list\ \{args\}\ \{\n\ \ return\ \$args\n\}\nset\ list\ \[str2list\ \{*\}\$string\]\n======\nin\ 8.5.\n<<categories>>\ Command\ |\ String\ Processing\n''\[escargo\]''\ -\ Reading\ the\ original\ TIP\ for\ \{expand\},\ it\ appears\ that\ it\ was\ intended\ to\ expand\na\ list\ into\ separate\ items\ for\ processing.\ \ So,\ using\ \{*\}\ as\ you\ did\ is\ working\ around\ the\ fact\nthat\ something\ is\ taking\ \$string\ and\ tokenizing\ it,\ treating\ the\ result\ as\ a\ list,\ and\ passing\ it\nto\ \{*\}\ to\ expand.\ \ Again,\ it\ seems,\ the\ tokenizing\ is\ buried\ where\ it\ is\ not\ accessible\ to\ a\ script.\n\nIt\ really\ seems\ like\ there\ ought\ to\ be\ a\ way.\ \ Right\ now\ split\ doesn't\ take\ any\ control\ arguments,\nso\ that\ '''\[\[split\ -tokens\ \$string\]\]'''\ wouldn't\ break\ any\ code.\n\n<<discussion>>\n\n<<categories>>\ Tcl\ syntax\ help\ |\ Command\ |\ String\ Processing} CALL {my revision split} CALL {::oo::Obj2360683 process revision/split} CALL {::oo::Obj2360681 process}

-errorcode

NONE

-errorinfo

Unknow state transition: LINE -> END
    while executing
"error $msg"
    (class "::Wiki" method "render_wikit" line 6)
    invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
    (class "::Wiki" method "render" line 8)
    invoked from within
"my render $name $C"
    (class "::Wiki" method "revision" line 31)
    invoked from within
"my revision $page"
    (class "::Wiki" method "process" line 56)
    invoked from within
"$server process [string trim $uri /]"

-errorline

4