Popular Tcl recipes tagged "text"http://code.activestate.com/recipes/langs/tcl/tags/text/popular/2011-03-21T23:10:10-07:00ActiveState Code RecipesBasic Text Editor (Tcl) 2011-03-21T23:10:10-07:00Jonathan Fenechhttp://code.activestate.com/recipes/users/4169413/http://code.activestate.com/recipes/577617-basic-text-editor/ <p style="color: grey"> Tcl recipe 577617 by <a href="/recipes/users/4169413/">Jonathan Fenech</a> (<a href="/recipes/tags/basic/">basic</a>, <a href="/recipes/tags/editor/">editor</a>, <a href="/recipes/tags/text/">text</a>). </p> <p>Text editor with copy,cut and paste functions.</p> Bits to Hex, and back (Tcl) 2002-08-21T16:48:53-07:00andreas kuprieshttp://code.activestate.com/recipes/users/117230/http://code.activestate.com/recipes/146037-bits-to-hex-and-back/ <p style="color: grey"> Tcl recipe 146037 by <a href="/recipes/users/117230/">andreas kupries</a> (<a href="/recipes/tags/text/">text</a>). </p> <p>Code to convert a string of '0's and '1's to the corresponding hex number, and back. Note that we are _not_ talking about binary strings. Code by Jeff Hobbs, from his bag of utilities.</p> Check creditcard numbers for wellformed-ness. (Tcl) 2002-08-22T16:03:11-07:00andreas kuprieshttp://code.activestate.com/recipes/users/117230/http://code.activestate.com/recipes/146221-check-creditcard-numbers-for-wellformed-ness/ <p style="color: grey"> Tcl recipe 146221 by <a href="/recipes/users/117230/">andreas kupries</a> (<a href="/recipes/tags/text/">text</a>). </p> <p>The command below checks if the specified creditcard number is syntactically valid. This code does __not__ check if there is actually creditcard with this number. Only that the number in itself is well-formed according to the rules of the creditcard companies. See the comments preceding the code for a list of the rules.</p> Dump a file in hex and ASCII (Tcl) 2002-06-17T15:27:20-07:00andreas kuprieshttp://code.activestate.com/recipes/users/117230/http://code.activestate.com/recipes/133525-dump-a-file-in-hex-and-ascii/ <p style="color: grey"> Tcl recipe 133525 by <a href="/recipes/users/117230/">andreas kupries</a> (<a href="/recipes/tags/text/">text</a>). </p> <p>Origin: <a href="http://wiki.tcl.tk/1599" rel="nofollow">http://wiki.tcl.tk/1599</a> Author: Original author unknown</p> <p>Demonstrates the use of the [binary] and [fconfigure] commands to process a binary file.</p> <p>The following useful Tcl script produces a hex/ASCII dump of a binary file whose name is specified on the command line.</p> Fuzzy Google truth (Tcl) 2002-06-11T15:40:48-07:00andreas kuprieshttp://code.activestate.com/recipes/users/117230/http://code.activestate.com/recipes/132606-fuzzy-google-truth/ <p style="color: grey"> Tcl recipe 132606 by <a href="/recipes/users/117230/">andreas kupries</a> (<a href="/recipes/tags/text/">text</a>). </p> <p>Origin: <a href="http://wiki.tcl.tk/3490" rel="nofollow">http://wiki.tcl.tk/3490</a> Author: Richard Suchenwirth</p> <p>Given some piece of data where it is doubtful whether they are correct or not, one way to find out is just to ask a search engine like Google, but disregard the results except for the number of found web pages. Chances are that the correct data have a higher hit rate than the faulty one.</p> <p>Example output in the text widget (asking about a city in Italy, where post code and province were unsure): 'bellaria rn': 3580 hits 'bellaria fo': 609 hits 'bellaria 47814': 1130 hits 'bellaria 47014': 30 hits</p> <p>These results seem to indicate that 47814 Bellaria RN (Rimini) is the correct address ;-) On single words one might use this for spelling verification: 'suchenwirth': 280 hits 'suchenworth': 0 hits</p> <p>..or to check how strong an association between several words is: 'suchenwirth tcl': 57 hits 'suchenwirth java': 14 hits</p> <p>The numbers may change over time, but the tendency ("fuzzy truth") can at least be estimated.</p> Getting stock quotes over the internet (Tcl) 2002-06-11T15:33:05-07:00andreas kuprieshttp://code.activestate.com/recipes/users/117230/http://code.activestate.com/recipes/132604-getting-stock-quotes-over-the-internet/ <p style="color: grey"> Tcl recipe 132604 by <a href="/recipes/users/117230/">andreas kupries</a> (<a href="/recipes/tags/text/">text</a>). </p> <p>Origin: <a href="http://wiki.tcl.tk/636" rel="nofollow">http://wiki.tcl.tk/636</a> Author: The original author is unknown.</p> <p>Here's a simple Tcl script which will fire up a window to track a small portfolio of stocks. Nothing too fancy. I've included an example portfolio of three stocks, and a cash holding. To see your own portfolio, simply edit the 'shares' array, and the 'cash' variable</p> Querying an online dictionary (Tcl) 2002-06-11T15:29:11-07:00andreas kuprieshttp://code.activestate.com/recipes/users/117230/http://code.activestate.com/recipes/132603-querying-an-online-dictionary/ <p style="color: grey"> Tcl recipe 132603 by <a href="/recipes/users/117230/">andreas kupries</a> (<a href="/recipes/tags/text/">text</a>). </p> <p>Origin: <a href="http://wiki.tcl.tk/3211" rel="nofollow">http://wiki.tcl.tk/3211</a> Author: Reinhard Max.</p> <p>This little script sends it's command line arguments as a query to the online dictionary at <a href="http://dict.leo.org" rel="nofollow">http://dict.leo.org</a> and writes the parsed result to stdout. It uses Tcl's http package and the htmlparse and ncgi packages from Tcllib.</p> <p>The scraper part (everything inside the ::dict.leo.org namespace) could also be included from other frontends. It's [query] proc takes a list of words to search for, and returns a list of english/german pairs that matched the query.</p> Flexible string splitting/parsing routine (Tcl) 2005-07-06T06:44:26-07:00Joe Mistachkinhttp://code.activestate.com/recipes/users/141324/http://code.activestate.com/recipes/116653-flexible-string-splittingparsing-routine/ <p style="color: grey"> Tcl recipe 116653 by <a href="/recipes/users/141324/">Joe Mistachkin</a> (<a href="/recipes/tags/text/">text</a>). Revision 2. </p> <p>This routine allows you to split a string on multiple characters. Additionally, you can specify the maximum number of elements to return. The final element will contain the remainder of the string.</p> Multi-character split (Tcl) 2001-09-10T10:07:20-07:00Jeff Hobbshttp://code.activestate.com/recipes/users/98167/http://code.activestate.com/recipes/68386-multi-character-split/ <p style="color: grey"> Tcl recipe 68386 by <a href="/recipes/users/98167/">Jeff Hobbs</a> (<a href="/recipes/tags/text/">text</a>). </p> <p>The split command splits a string based on each character that is in the splitString. This version handles the splitString as a combined string, splitting the string into constituent parts.</p> Add Commas to a Number (Tcl) 2001-09-09T21:21:34-07:00Keith Vetterhttp://code.activestate.com/recipes/users/130056/http://code.activestate.com/recipes/68381-add-commas-to-a-number/ <p style="color: grey"> Tcl recipe 68381 by <a href="/recipes/users/130056/">Keith Vetter</a> (<a href="/recipes/tags/text/">text</a>). </p> <p>Takes a number and inserts a comma (or separator of your choice) between every third digit.</p> rot13 filter (Tcl) 2001-09-10T08:11:23-07:00Glenn Jackmanhttp://code.activestate.com/recipes/users/130139/http://code.activestate.com/recipes/68383-rot13-filter/ <p style="color: grey"> Tcl recipe 68383 by <a href="/recipes/users/130139/">Glenn Jackman</a> (<a href="/recipes/tags/text/">text</a>). </p> <p>Encodes the standard input channel using the rot13 scheme. Output goes to standard output.</p> Simple templating routine (Tcl) 2001-07-30T16:53:33-07:00Chui Teyhttp://code.activestate.com/recipes/users/98139/http://code.activestate.com/recipes/66450-simple-templating-routine/ <p style="color: grey"> Tcl recipe 66450 by <a href="/recipes/users/98139/">Chui Tey</a> (<a href="/recipes/tags/text/">text</a>). </p> <p>This routine performs simple text templating using ASP style code embedding. Useful as Wizards for source code generation or generate html.</p> Tail a file (Tcl) 2001-06-21T17:03:08-07:00Jeff Hobbshttp://code.activestate.com/recipes/users/98167/http://code.activestate.com/recipes/65437-tail-a-file/ <p style="color: grey"> Tcl recipe 65437 by <a href="/recipes/users/98167/">Jeff Hobbs</a> (<a href="/recipes/tags/text/">text</a>). </p> <p>Comp.lang.tcl questioners frequently demand some sort of gadget to monitor an ongoing process and display the result in a text. The following widget is the simplest answer I know that meets the common intent of these requests.</p> Text to HTML (Tcl) 2001-06-21T16:27:26-07:00Jeff Hobbshttp://code.activestate.com/recipes/users/98167/http://code.activestate.com/recipes/65428-text-to-html/ <p style="color: grey"> Tcl recipe 65428 by <a href="/recipes/users/98167/">Jeff Hobbs</a> (<a href="/recipes/tags/text/">text</a>). </p> <p>Scan the files in the current directory and wrap them into html/body tags so that netscape will display them as HTML and not as text.</p>