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

	<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>2003-02-18T10:34:46-04:00</updated>

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

		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2003-02-18T10:34:46-04:00</updated>

		<published>2003-02-18T10:34:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=16752#p16752</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=16752#p16752"/>
		<title type="html"><![CDATA[long line spliting...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=16752#p16752"><![CDATA[
Somthing like<div class="codebox"><p>Code: </p><pre><code>proc createarray {name input delimeter args} {  set inject "\n"  if {[lindex $args 0] != ""} { set inject "[lindex $args 0] }  set output ""  regsub -all -- $delimeter $input $inject output  set i 1  foreach a [split $output $inject] {    uplevel 1 [list set "${name}(${i})" $a]  }}</code></pre></div>You can use it like follows.<br><div class="codebox"><p>Code: </p><pre><code>set html "&lt;quite much html code&gt;&lt;/a&gt;&lt;br&gt;&lt;again much html code&gt;&lt;/a&gt;&lt;br&gt;&lt;even more html code&gt; .... (and so on)&lt;/a&gt;&lt;br&gt; &lt;/td&gt;"createarray this $html "&lt;br&gt;"puts stdout "First line: $this(1)"puts stdout "Second: $this(2)"</code></pre></div>Unlike some langs, you can't go out of bounds with Tcl arrays. It causes an error of "Variable doesn't exist".<br><br>You may find it is far easier to stick with the existing code (the one posted in your previous reply), and use "[lindex $lines 0]" and so on.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Tue Feb 18, 2003 10:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[GodOfSuicide]]></name></author>
		<updated>2003-02-18T10:24:47-04:00</updated>

		<published>2003-02-18T10:24:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=16751#p16751</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=16751#p16751"/>
		<title type="html"><![CDATA[long line spliting...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=16751#p16751"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set html "&lt;quite much html code&gt;&lt;/a&gt;&lt;br&gt;&lt;again much html code&gt;&lt;/a&gt;&lt;br&gt;&lt;even more html code&gt; .... (and so on)&lt;/a&gt;&lt;br&gt; &lt;/td&gt;"regsub -all "&lt;br&gt;" $html "\n" htmlset lines [split $html "\n"]</code></pre></div>how could i acces to the lines with some kinda array (like in delphi information[1], information[2], etc) ? i could loop i throught a counter and check all lines easily with that.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1433">GodOfSuicide</a> — Tue Feb 18, 2003 10:24 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Papillon]]></name></author>
		<updated>2003-02-18T04:42:26-04:00</updated>

		<published>2003-02-18T04:42:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=16742#p16742</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=16742#p16742"/>
		<title type="html"><![CDATA[long line spliting...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=16742#p16742"><![CDATA[
I was not aware that it is only splitting on single chars... thanks for enlightening me stdragon <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=852">Papillon</a> — Tue Feb 18, 2003 4:42 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2003-02-17T16:41:47-04:00</updated>

		<published>2003-02-17T16:41:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=16723#p16723</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=16723#p16723"/>
		<title type="html"><![CDATA[long line spliting...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=16723#p16723"><![CDATA[
Unfortunately split always splits on single letters. Splitting on "&lt;br&gt;" simply splits the line at &lt;, b, r, and &gt;.<br><br>I think GodOfSuicide was on the right track with regsub and \n.<br><div class="codebox"><p>Code: </p><pre><code>set html "&lt;quite much html code&gt;&lt;/a&gt;&lt;br&gt;&lt;again much html code&gt;&lt;/a&gt;&lt;br&gt;&lt;even more html code&gt; .... (and so on)&lt;/a&gt;&lt;br&gt; &lt;/td&gt;"regsub -all "&lt;br&gt;" $html "\n" htmlset lines [split $html "\n"]</code></pre></div>Note you don't get pure lines of text from this -- it leaves all other tags in the code. You could use another regsub to get rid of them.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Mon Feb 17, 2003 4:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Papillon]]></name></author>
		<updated>2003-02-17T15:17:52-04:00</updated>

		<published>2003-02-17T15:17:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=16716#p16716</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=16716#p16716"/>
		<title type="html"><![CDATA[long line spliting...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=16716#p16716"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>set newline [split $oldline "&lt;br&gt;"]</code></pre></div>will return a list with each line as a element in the list<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=852">Papillon</a> — Mon Feb 17, 2003 3:17 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[GodOfSuicide]]></name></author>
		<updated>2003-02-17T15:13:52-04:00</updated>

		<published>2003-02-17T15:13:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=16715#p16715</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=16715#p16715"/>
		<title type="html"><![CDATA[long line spliting...]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=16715#p16715"><![CDATA[
i have a very long string (~600 chars) which i want to split up into some lines.<br><br>the line looks something like this :<blockquote class="uncited"><div>&lt;quite much html code&gt;&lt;/a&gt;&lt;br&gt;&lt;again much html code&gt;&lt;/a&gt;&lt;br&gt;&lt;even more html code&gt; .... (and so on)&lt;/a&gt;&lt;br&gt;    &lt;/td&gt;</div></blockquote>everytime there is the &lt;br&gt; (which means new line in html) tag i want the string to be split up so i can acces to each "real" html line directly.<br><br>i tried it with regsub &amp; \n, but it didnt work.....<br><br>would be great if somebody could help.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=1433">GodOfSuicide</a> — Mon Feb 17, 2003 3:13 pm</p><hr />
]]></content>
	</entry>
	</feed>
