<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AdeCode &#187; utils</title>
	<atom:link href="http://code.aderowbotham.com/category/utils/feed/" rel="self" type="application/rss+xml" />
	<link>http://code.aderowbotham.com</link>
	<description>Ade as in Lemonade, Code as in Code</description>
	<lastBuildDate>Sun, 03 Jan 2010 15:27:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Remove spaces</title>
		<link>http://code.aderowbotham.com/2009/09/remove-spaces/</link>
		<comments>http://code.aderowbotham.com/2009/09/remove-spaces/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 16:31:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[utils]]></category>

		<guid isPermaLink="false">http://code.aderowbotham.com/?p=34</guid>
		<description><![CDATA[Busy busy busy&#8230;. I&#8217;ve been too busy to blog for longer than I can remember. I&#8217;ve got loads of stuff to post, but it needs a bit of cleaning up first (as most of it suffered late night last-minute hacks to accommodate client changes). But anyway, here&#8217;s a simple little String function that removes any [...]]]></description>
			<content:encoded><![CDATA[<p>Busy busy busy&#8230;. I&#8217;ve been too busy to blog for longer than I can remember.</p>
<p>I&#8217;ve got loads of stuff to post, but it needs a bit of cleaning up first (as most of it suffered late night last-minute hacks to accommodate client changes).</p>
<p>But anyway, here&#8217;s a simple little String function that removes any spaces from the start or end of a String, and removes any multiple spaces from within a String.</p>
<p>For example:</p>
<pre>Input: "&nbsp;&nbsp;&nbsp;&nbsp; Hello&nbsp;&nbsp;&nbsp;world        "
Output: "Hello world" </pre>
<p>Here&#8217;s the code (Flash AS3):</p>
<pre>function removeSpaces(string:String):String{

	//remove spaces at start
	while(string.substr(0,1) == " "){
		string = string.substring(1);
	}
	//remove multiple spaces in middle
	while(string.indexOf("  ") != -1){
		string = string.split("  ").join(" ");
	}
	while(string.substr(-1) == " "){
		string = string.substr(0,string.length-1);
	}
	return string;
}</pre>
<p>Might save you five minutes!</p>
]]></content:encoded>
			<wfw:commentRss>http://code.aderowbotham.com/2009/09/remove-spaces/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sequence Randomiser</title>
		<link>http://code.aderowbotham.com/2009/02/sequence-randomiser/</link>
		<comments>http://code.aderowbotham.com/2009/02/sequence-randomiser/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 12:18:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[utils]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[randomisation]]></category>
		<category><![CDATA[randomise]]></category>
		<category><![CDATA[randomization]]></category>
		<category><![CDATA[randomize]]></category>
		<category><![CDATA[sequencer]]></category>
		<category><![CDATA[sequences]]></category>

		<guid isPermaLink="false">http://code.aderowbotham.com/?p=25</guid>
		<description><![CDATA[So I said I&#8217;d be back and here I am. I won&#8217;t bore you with specific excuses but I&#8217;ve honestly had a lot to do in the last few months. Here&#8217;s another simple utility that came out of something old. It simply returns an array of consecutive integers, only in a random order, with no [...]]]></description>
			<content:encoded><![CDATA[<p>So I said I&#8217;d be back and here I am. I won&#8217;t bore you with specific excuses but I&#8217;ve honestly had a lot to do in the last few months.</p>
<p>Here&#8217;s another simple utility that came out of something old. It simply returns an array of consecutive integers, only in a random order, with no reptition. By default the smallest value is zero and the highest is the length of array requested &#8211; 1. However you can set the base value via an optional second argument.</p>
<p>A typical usage would be to trigger a number of animations in a random order. </p>
<p>Again, simple stuff but if it saves you 10 minutes then this post was worthwhile.</p>
<p>Files:<br />
<a href="/source/com/aderowbotham/utils/SequenceRandomiser.as">com.aderowbotham.utils.SequenceRandomiser</a></p>
<p>Usage:</p>
<pre>
import com.aderowbotham.utils.SequenceRandomiser;

//create a sequence of length 10
var mySequence:Array = SequenceRandomiser.createSequence(10);
trace(mySequence);    //e.g. 5,0,7,8,2,4,1,9,6,3

//create a sequence of length 10, from -5
mySequence = SequenceRandomiser.createSequence(10,-5);
trace(mySequence);    //e.g. -4,-5,0,-3,2,1,3,-2,4,-1
</pre>
]]></content:encoded>
			<wfw:commentRss>http://code.aderowbotham.com/2009/02/sequence-randomiser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Source</title>
		<link>http://code.aderowbotham.com/2008/08/source/</link>
		<comments>http://code.aderowbotham.com/2008/08/source/#comments</comments>
		<pubDate>Sun, 10 Aug 2008 16:33:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[utils]]></category>

		<guid isPermaLink="false">http://code.aderowbotham.com/?p=12</guid>
		<description><![CDATA[To kick off (and I&#8217;ve not got anything else ready) I&#8217;ve posted some AS3 source code. At the moment, this just contains my utils directory and doesn&#8217;t really do much on its own. The rest will slot into this folder structure as and when it&#8217;s ready: code.aderowbotham.com/source You may find a few handy bits and [...]]]></description>
			<content:encoded><![CDATA[<p>To kick off (and I&#8217;ve not got anything else ready) I&#8217;ve posted <a title="Source Code" href="/source/">some AS3 source code</a>. At the moment, this just contains my <em>utils</em> directory and doesn&#8217;t really do much on its own. The rest will slot into this folder structure as and when it&#8217;s ready:</p>
<p><a title="Source Code" href="/source/">code.aderowbotham.com/source</a></p>
<p>You may find a few handy bits and pieces in there. There&#8217;s not much at present but I reuse these classes a lot.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.aderowbotham.com/2008/08/source/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

