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

	<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>2002-05-22T14:30:00-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Petersen]]></name></author>
		<updated>2002-05-22T14:30:00-04:00</updated>

		<published>2002-05-22T14:30:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7167#p7167</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7167#p7167"/>
		<title type="html"><![CDATA[Comparing 2 scrambled words]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7167#p7167"><![CDATA[
% time {if {"a" == "a"} {}} 1000<br>12 microseconds per iteration<br>% time {if {![string compare "a" "a"]} {}} 1000<br>13 microseconds per iteration<br><br>string compare is slower performance wise than a simple ==, though if you have to throw in case exemption then its slightly faster. However, it isn't portable to lower tcl vers if you do that.<br><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=60">Petersen</a> — Wed May 22, 2002 2:30 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-05-22T13:13:00-04:00</updated>

		<published>2002-05-22T13:13:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7165#p7165</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7165#p7165"/>
		<title type="html"><![CDATA[Comparing 2 scrambled words]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7165#p7165"><![CDATA[
We want to know if the strings are equal, don't we? So that's the result we'd want. Basically using string equal would be better.<br><blockquote class="uncited"><div>The problem is that the equality operator always tries to convert both<br>of the strings to integers, and if this fails, tries to convert both <br>into double, and if that fails, compares the strings as strings.<br><br>On the other hand, the [string foo] procedures are not compiled by tcl8!<br><br>So you loose performance with both. Nevertheless, [string compare ...]<br>is better than == in most cases, and [string length ...] always wins <br>over == "".</div></blockquote>string compare doesn't compare in a numerical sense but in a lexicographical sense. see the man pages:<br><blockquote class="uncited"><div>string compare ?-nocase? ?-length int? string1 string2<br>Perform a character-by-character comparison of strings string1 and string2. Returns -1, 0, or 1, depending on whether string1 is lexicographically less than, equal to, or greater than string2. If -length is specified, then only the first length characters are used in the comparison. If -length is negative, it is ignored. If -nocase is specified, then the strings are compared in a case-insensitive manner. </div></blockquote><p>Statistics: Posted by Guest — Wed May 22, 2002 1:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Petersen]]></name></author>
		<updated>2002-05-22T08:38:00-04:00</updated>

		<published>2002-05-22T08:38:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7155#p7155</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7155#p7155"/>
		<title type="html"><![CDATA[Comparing 2 scrambled words]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7155#p7155"><![CDATA[
[11:34] &lt;Petersen&gt; .tcl string compare abc cba<br>[11:34] &lt;gaynewf&gt; TCL: -1<br>[11:34] &lt;Petersen&gt; .tcl string compare bac abc<br>[11:34] &lt;gaynewf&gt; TCL: 1<br>[11:35] &lt;Petersen&gt; .tcl string compare abc abc<br>[11:35] &lt;gaynewf&gt; TCL: 0<br><br>do you see? string compare will not help you compare scrambled words, as all it does is check if the string on the left is less than (in a numerical sense) than the one on the right. The only time it ever returns true is in the third instance, where the strings are actually exactly the same (in which case if {$string1 == $string2} is a lot more efficient)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=60">Petersen</a> — Wed May 22, 2002 8:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-05-22T05:46:00-04:00</updated>

		<published>2002-05-22T05:46:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7154#p7154</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7154#p7154"/>
		<title type="html"><![CDATA[Comparing 2 scrambled words]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7154#p7154"><![CDATA[
Already have... simply works... no problems... Maybe I'm thick but I can't see the problem...<p>Statistics: Posted by Guest — Wed May 22, 2002 5:46 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Petersen]]></name></author>
		<updated>2002-05-21T19:30:00-04:00</updated>

		<published>2002-05-21T19:30:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7144#p7144</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7144#p7144"/>
		<title type="html"><![CDATA[Comparing 2 scrambled words]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7144#p7144"><![CDATA[
you try coding it and then you'll discover why it can't be used <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":razz:" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=60">Petersen</a> — Tue May 21, 2002 7:30 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-05-21T18:57:00-04:00</updated>

		<published>2002-05-21T18:57:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7142#p7142</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7142#p7142"/>
		<title type="html"><![CDATA[Comparing 2 scrambled words]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7142#p7142"><![CDATA[
Why not use string compare as it's faster and you can use the -nocase flag since tcl 8.3 so you won't need to convert to upper- or lowercase first...<p>Statistics: Posted by Guest — Tue May 21, 2002 6:57 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[z_one]]></name></author>
		<updated>2002-05-20T13:01:00-04:00</updated>

		<published>2002-05-20T13:01:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7102#p7102</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7102#p7102"/>
		<title type="html"><![CDATA[Comparing 2 scrambled words]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7102#p7102"><![CDATA[
Thx revered one .. oops I mean ppslim <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":smile:" title="Smile"><br><br>&lt;font size=-1&gt;[ This Message was edited by: z_one on 2002-05-20 11:01 ]&lt;/font&gt;<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=698">z_one</a> — Mon May 20, 2002 1:01 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-05-20T11:20:00-04:00</updated>

		<published>2002-05-20T11:20:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7097#p7097</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7097#p7097"/>
		<title type="html"><![CDATA[Comparing 2 scrambled words]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7097#p7097"><![CDATA[
You will need to convert the 2 words to lower or uppercase first, as the match is case sansative.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Mon May 20, 2002 11:20 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-05-20T11:19:00-04:00</updated>

		<published>2002-05-20T11:19:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7096#p7096</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7096#p7096"/>
		<title type="html"><![CDATA[Comparing 2 scrambled words]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7096#p7096"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set scramble1 "hlleo"set scramble2 "loehl"if {[join [lsort [split $scramble1 {}]] {}] == [join [lsort [split $scramble2 {}]] {}]} {Words match} else {words do not match}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Mon May 20, 2002 11:19 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[z_one]]></name></author>
		<updated>2002-05-20T11:02:00-04:00</updated>

		<published>2002-05-20T11:02:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=7094#p7094</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=7094#p7094"/>
		<title type="html"><![CDATA[Comparing 2 scrambled words]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=7094#p7094"><![CDATA[
Is there a way to compare two strings of same length to see if they are made of the same characters ?<br><br>Example: "hello" and "lleho"<br><br>If yes what would be the tcl code to do that ?<br><br>Thanks<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=698">z_one</a> — Mon May 20, 2002 11:02 am</p><hr />
]]></content>
	</entry>
	</feed>
