<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/16222" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2008-10-08T12:16:48-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/16222</id>

		<entry>
		<author><name><![CDATA[TCL_no_TK]]></name></author>
		<updated>2008-10-08T12:16:48-04:00</updated>

		<published>2008-10-08T12:16:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85465#p85465</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85465#p85465"/>
		<title type="html"><![CDATA[Replace random words in a string of text with asterisks]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85465#p85465"><![CDATA[
<a href="http://forum.purehype.net/phpBB3/viewtopic.php?f=32&amp;t=694&amp;p=2136#p2136" class="postlink">MC_8's More Tools</a> dose this, read the script for more information on the syntax. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8130">TCL_no_TK</a> — Wed Oct 08, 2008 12:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[leprechau]]></name></author>
		<updated>2008-10-04T00:11:14-04:00</updated>

		<published>2008-10-04T00:11:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=85390#p85390</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=85390#p85390"/>
		<title type="html"><![CDATA[Replace random words in a string of text with asterisks]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=85390#p85390"><![CDATA[
I'm not sure exactly who it was, and I can't find the exact post now, but hopefully whoever needed it will find it here.  This was a topic I read awhile ago and just thought I would post something I threw together in TCLSH this evening.  Hope it helps someone.<br><div class="codebox"><p>Code: </p><pre><code>proc wordMask {text {num {1}}} {set txtl [expr {[llength $text] -1}]; set rlist [list]if {$num &gt; [llength $text]} {set num [llength $text]}while {[llength $rlist] &lt; $num} {set x [expr {round(rand()*$txtl)}]lappend rlist $x; set rlist [lsort -unique $rlist]}set outs [split $text]; foreach idx $rlist {set outs [lreplace $outs $idx $idx [regsub -all -- {[[:alnum:]]} [set rep [lindex $outs $idx]] {*}]]lappend reps [regsub -all -- {[\!\.\?\;\:\"]} $rep {}]}; return [list [join $outs] [join $reps]]}</code></pre></div>Usage example:<br><div class="codebox"><p>Code: </p><pre><code>foreach {mask reps} [wordMask $text 5] {}</code></pre></div>This gives you two variables you can use later on as follows....<br><div class="codebox"><p>Code: </p><pre><code>puts "Masked Text -&gt; $mask"</code></pre></div>Will give you: Masked Text -&gt; Hello **** *'** ** **** ****!<br><div class="codebox"><p>Code: </p><pre><code>puts "Replaced Words -&gt; $reps"</code></pre></div>Will give you: Replaced Words -&gt; dear I'll be home soon<br><br>That's it...pretty simple and if you read the code in the proc declaration you can see the script will default to replacing 1 word in the passed text, but any other number can be specified if desired.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10247">leprechau</a> — Sat Oct 04, 2008 12:11 am</p><hr />
]]></content>
	</entry>
	</feed>
