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

	<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-04-01T15:40:00-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-04-01T15:40:00-04:00</updated>

		<published>2002-04-01T15:40:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=5885#p5885</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=5885#p5885"/>
		<title type="html"><![CDATA[Substituting character strings for text]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=5885#p5885"><![CDATA[
Ahh, thanks egghead, gave me some ideas <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":smile:" title="Smile"> I havent used the switch command yet so I'm still reading through your example, but it has me thinking. I had a "writers block" on this one <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":smile:" title="Smile"><p>Statistics: Posted by Guest — Mon Apr 01, 2002 3:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[egghead]]></name></author>
		<updated>2002-04-01T13:55:00-04:00</updated>

		<published>2002-04-01T13:55:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=5878#p5878</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=5878#p5878"/>
		<title type="html"><![CDATA[Substituting character strings for text]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=5878#p5878"><![CDATA[
There are various ways: for example, split the string around *, and review each item of the list while keeping track of the number of {} in the list. Or split the string into a list of single characters and review each character.<br>Another way is to scan out substrings with and without *'s and upon each scan remove the scanned substring from the string. See below.<br><div class="codebox"><p>Code: </p><pre><code>#---------------------------------------------------------------------# countstars# On input a string, returns a string with the ***'s replaced by# &lt;# stars&gt;#---------------------------------------------------------------------proc countstars { string } {   set newstring {}   while { $string != "" } {      # substring without stars?      if {[scan $string {%[^*]} substring] == 1 } {          append newstring $substring         set sublength [string length $substring]         set string [string range $string $sublength end]      }      # substring with stars?      if {[scan $string {%[*]} substring] == 1 } {         set starcount [string length $substring]         switch -- $starcount {            1 { append newstring "&lt;1 star&gt;" }            default { append newstring "&lt;$starcount stars&gt;" }         }         set string [string range $string $starcount end]      }   }   return $newstring}# for testing purposes onlyset string {This hotel has *****, but it is not even worth * or **}puts "B: $string!"puts "A: [countstars $string]!"</code></pre></div>&lt;font size=-1&gt;[ This Message was edited by: egghead on 2002-04-01 11:00 ]&lt;/font&gt;<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=282">egghead</a> — Mon Apr 01, 2002 1:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2002-03-31T14:31:00-04:00</updated>

		<published>2002-03-31T14:31:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=5846#p5846</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=5846#p5846"/>
		<title type="html"><![CDATA[Substituting character strings for text]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=5846#p5846"><![CDATA[
Here's a bit of a curly one I'm having trouble getting my head around. Say I have a string like this: "blah1***blah2****"<br><br>I want to convert it to a string as follows:<br>"blah1&lt;3 stars&gt;blah2&lt;4stars&gt;"<br><br>Anyone got any thoughts on how I'd do it? There could be anywhere from 1 to 100 stars in any given block. Without going into the semantics of why I need to do it, it's not a proposition to just order the data differently. I need to be able to make a conversion as outlined.<p>Statistics: Posted by Guest — Sun Mar 31, 2002 2:31 pm</p><hr />
]]></content>
	</entry>
	</feed>
