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

	<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>2004-10-27T04:36:08-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-10-27T04:36:08-04:00</updated>

		<published>2004-10-27T04:36:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=42270#p42270</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=42270#p42270"/>
		<title type="html"><![CDATA[spliting chars ..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=42270#p42270"><![CDATA[
verry nice indeed.. i knew it was gone slow it a bit down but didn't expected so mutch.. tnx .<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Wed Oct 27, 2004 4:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2004-10-26T17:39:34-04:00</updated>

		<published>2004-10-26T17:39:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=42254#p42254</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=42254#p42254"/>
		<title type="html"><![CDATA[spliting chars ..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=42254#p42254"><![CDATA[
<blockquote class="uncited"><div>allready found a way <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><div class="codebox"><p>Code: </p><pre><code>foreach x [array names modesArray] {  puts "NICK [lindex [string map {\x5F\x23 \x20\x23} $x] 0] CHAN [strin map {\x20\x23 \x5F\x23} [join [lrange [string map {\x5F\x23 \x20\x23} $x] 1 end]]]]"}</code></pre></div></div></blockquote>Looks like you're using lindex/lrange on a string there... and btw: there's nothing wrong with writing those chars directly in your code instead of using escapes. The escapes just add to the number of substitutions required and slow things down.<br>Here's a regexp to do the "splitting" for you (if you refuse to change the join to a single char <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz">) <div class="codebox"><p>Code: </p><pre><code>regexp {^(.+?)_(#.*)$} $x nick nick chan</code></pre></div>And here's why you should consider using a single char:<div class="codebox"><p>Code: </p><pre><code># some test dataarray set a {nick,#chan abc nick,#chan2 def nick,#chan3 ghi nick,#chan4 jkl nick,#chan5 mno}# some testsforeach way {{foreach {n c} [split [join [array names a] ,] ,] {set xxx $n,$c}}{foreach n [array names a] {scan $n {%[^,],%s} n c; set xxx $n,$c}}{foreach n [array names a] {set i [expr {[string first ",#" $n]-1}]; set xxx [string range $n 0 $i],[string range $n [incr i 2] end]}}{foreach n [array names a] {regexp {^(.+?),(.+)$} $n n n c; set xxx $n,$c}}{foreach n [array names a] {set xxx [lindex [split [string map {, " "} $n]] 0],[join [lrange [split [string map {, " "} $n]] 1 end] ""]}}} {puts "[time $way 10000]: $way"}</code></pre></div>Run it and take a look at the times <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br>The first one is similar to your first suggestion<br>The last one is roughly what you did in your final solution<br>The third way would also handle multiple chars (if you insist on that) and seems to be about twice as fast as your map/split/join/lrange+join thing <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Tue Oct 26, 2004 5:39 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-10-26T17:17:49-04:00</updated>

		<published>2004-10-26T17:17:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=42253#p42253</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=42253#p42253"/>
		<title type="html"><![CDATA[spliting chars ..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=42253#p42253"><![CDATA[
allready found a way <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><div class="codebox"><p>Code: </p><pre><code>foreach x [array names modesArray] {  puts "NICK [lindex [string map {\x5F\x23 \x20\x23} $x] 0] CHAN [strin map {\x20\x23 \x5F\x23} [join [lrange [string map {\x5F\x23 \x20\x23} $x] 1 end]]]]"}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Tue Oct 26, 2004 5:17 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-10-26T17:13:34-04:00</updated>

		<published>2004-10-26T17:13:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=42252#p42252</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=42252#p42252"/>
		<title type="html"><![CDATA[spliting chars ..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=42252#p42252"><![CDATA[
well i was trying to think of one lol sorry hehe<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Tue Oct 26, 2004 5:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2004-10-26T16:56:30-04:00</updated>

		<published>2004-10-26T16:56:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=42251#p42251</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=42251#p42251"/>
		<title type="html"><![CDATA[spliting chars ..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=42251#p42251"><![CDATA[
wtf are you trying to do and why don't you use a char that can't be part of a nick/channel name? like ","?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Tue Oct 26, 2004 4:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-10-26T16:46:11-04:00</updated>

		<published>2004-10-26T16:46:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=42250#p42250</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=42250#p42250"/>
		<title type="html"><![CDATA[spliting chars ..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=42250#p42250"><![CDATA[
you could probably do this with regexp as well and i tryed but can't find the proper syntax<br><br>* couldn't edit ...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Tue Oct 26, 2004 4:46 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Ofloo]]></name></author>
		<updated>2004-10-26T16:31:40-04:00</updated>

		<published>2004-10-26T16:31:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=42249#p42249</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=42249#p42249"/>
		<title type="html"><![CDATA[spliting chars ..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=42249#p42249"><![CDATA[
is there a way beter way to do this and make it work tho cause this aint working<br><br><div class="codebox"><p>Code: </p><pre><code>set modesArray(nick_#chan_#) abcset modesArray(nick_#chan) defset modesArray(nick_#_##_#) ghiforeach {a b} "[lindex [string map {\x5F\x23 \x20\x23} [array names modesArray]] 0] [string map {\x20\x23 \x5F\x23} [join [lrange [string map {\x5F\x23 \x20\x23} [array names modesArray]] 1 end]]]" { puts "NICK: $a CHAN: $b" }</code></pre></div>normal i would do <br><br>you can also do this with regexp but i can't find he proper synatx to do so ..<br>i also tryed with regexp but i am not able to get the proper syntax ..<br><br>split [array names modesArray] \x5F<br><br>but because channel names &amp; nick names can contain a "_" char \x5F .. i have to find an other way..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3151">Ofloo</a> — Tue Oct 26, 2004 4:31 pm</p><hr />
]]></content>
	</entry>
	</feed>
