<?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/13254" />

	<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>2007-03-18T13:27:44-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2007-03-18T13:27:44-04:00</updated>

		<published>2007-03-18T13:27:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71353#p71353</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71353#p71353"/>
		<title type="html"><![CDATA[string map question]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71353#p71353"><![CDATA[
When you create lists using {} everything between the braces won't be evaluated, which means all Tcl commands and variables will be treated as normal strings or elements inside the list. <ul> <li>does the same thing (creates a list), but everything after <ul> <li>will be evaluated thus you can use variables and commands in it.</li></ul></li></ul><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sun Mar 18, 2007 1:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[subarashii]]></name></author>
		<updated>2007-03-18T13:18:02-04:00</updated>

		<published>2007-03-18T13:18:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71352#p71352</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71352#p71352"/>
		<title type="html"><![CDATA[string map question]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71352#p71352"><![CDATA[
tnx a lot. It works now. The list-command was the problem. TCL syntax still confuses me a lot.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8818">subarashii</a> — Sun Mar 18, 2007 1:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-03-18T10:59:37-04:00</updated>

		<published>2007-03-18T10:59:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71349#p71349</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71349#p71349"/>
		<title type="html"><![CDATA[string map question]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71349#p71349"><![CDATA[
The reason why the second version does not work, is that you provide the two strings as separate arguments, whereas the documentation clearly specifies that string map expects &lt;map&gt; to be a (single argument) list with value pairs.<br><br>Use this instead:<div class="codebox"><p>Code: </p><pre><code>set nword [string map -nocase [list $string_one $string_two] $mytext];</code></pre></div>I would also suggest using the list-command whenever you build a list from strings; ie:<div class="codebox"><p>Code: </p><pre><code>set nword [string map -nocase [list "not" "good" "script" "tcl script"] $mytext]</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sun Mar 18, 2007 10:59 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[subarashii]]></name></author>
		<updated>2007-03-18T10:39:38-04:00</updated>

		<published>2007-03-18T10:39:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71348#p71348</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71348#p71348"/>
		<title type="html"><![CDATA[string map question]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71348#p71348"><![CDATA[
Hi there,<br><br>I have a question regarding the string map command. What i understand so far: In general you have to set up pairs of words which are replaced by their counterparts. So in this example "not" and "script" is being replaced to "good" and "tcl script". <br><div class="codebox"><p>Code: </p><pre><code>set mytext "i am a not working script"set nword [string map -nocase { "not" "good""script" "tcl script"} $mytext];putmsg $chan "$nword";.. and so on</code></pre></div>This example works fine. But if i try to insert string variables like lets say:<div class="codebox"><p>Code: </p><pre><code>set string_one "not"set string_two "good"set nword [string map -nocase { $string_one $string_two} $mytext];</code></pre></div>Well my noobish version does not work <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"> Manual pages says this: <blockquote class="uncited"><div>Replaces substrings in string based on the key-value pairs in mapping. mapping is a list of key value key value ... as in the form returned by array get.</div></blockquote>I tried some variations resulting in not replacing the string or in inbalance char maps. Can someone drop me a quick feedback how to solve this?<br><br>tnx in advance<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8818">subarashii</a> — Sun Mar 18, 2007 10:39 am</p><hr />
]]></content>
	</entry>
	</feed>
