There ya go:
<cfscript>
function colonise(s, out="") {
return (s eq "") ? out : colonise(mid(s, 3, Len(s)), listAppend(out,
left(s, 2), ":"));
}
writeOutput(colonise("1Z0617756740260660"));
</cfscript>
Missed a len.
It just recursively runs through the string, taking two off the front of s
and putting them back on out until s eq "".
Mark
On Thu, Jul 11, 2013 at 2:09 PM, Dale Fraser <[email protected]> wrote:
> That looks very clever, I don’t understand it so I tried to run it and
> work it out,****
>
> ** **
>
> But it doesn’t work for me.****
>
> ** **
>
> Mid requires 3 params but you are passing 2, so not sure ****
>
> ** **
>
> Regards****
>
> Dale Fraser****
>
> ** **
>
> *From:* [email protected] [mailto:[email protected]] *On
> Behalf Of *Robin Hilliard
> *Sent:* Thursday, 11 July 2013 11:26 AM
> *To:* [email protected]
> *Subject:* Re: [cfaussie] String Manipulation****
>
> ** **
>
> Or perhaps fp-style:****
>
> ** **
>
> function colonise(s, out="") {****
>
> return (s eq "") ? out : colonise(mid(s, 3), listAppend(out,
> left(s, 2), ":"));****
>
> }****
>
> ** **
>
> writeOutput(colonise("1Z0617756740260660"));****
>
> ** **
>
> Cheers,****
>
> Robin****
>
> ** **
>
> ****
>
> ** **
>
> Robin Hilliard****
>
> Chief Technology Officer****
>
> RocketBoots Pty Ltd****
>
> Level 11****
>
> 189 Kent Street****
>
> Sydney NSW 2001****
>
> Australia map <http://goo.gl/maps/RKyY9>****
>
> Phone +61 2 9323 2507****
>
> Facsimile +61 2 9323 2501****
>
> Mobile +61 418 414 341****
>
> email [email protected]****
>
> web www.rocketboots.com.au****
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
>
>
>
> ****
>
> ** **
>
> On 11/07/2013, at 12:28 AM, [email protected] wrote:****
>
>
>
> ****
>
> Hi I am trying to figure our the best way to manipulate the value using
> CF so I insert : after ever 2 characters as in converting
> 1Z0617756740260660 to 1Z:06:17:75:67:40:26:06:60****
>
> ****
>
> Any suggestions would be appreciated****
>
> ****
>
> ****
>
> ****
>
> Kind Regards****
>
> ****
>
> Claude Raiola****
>
> Director****
>
> ****
>
> <image001.gif>****
>
> ****
>
> TrackingCentral Pty Ltd (A.C.N. 150 409 180)****
>
> Web: www.TrackingCentral.com.au <http://www.trackingcentral.com.au/>****
>
> Email: [email protected]****
>
> Call 1300 255 990****
>
> ****
>
> ** **
>
> --
> You received this message because you are subscribed to the Google Groups
> "cfaussie" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/cfaussie.
> For more options, visit https://groups.google.com/groups/opt_out. ****
>
> ** **
>
> --
> You received this message because you are subscribed to the Google Groups
> "cfaussie" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/cfaussie.
> For more options, visit https://groups.google.com/groups/opt_out.
>
> ****
>
> --
> You received this message because you are subscribed to the Google Groups
> "cfaussie" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/cfaussie.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
E: [email protected]
T: http://www.twitter.com/neurotic
W: www.compoundtheory.com
2 Devs from Down Under Podcast
http://www.2ddu.com/
--
You received this message because you are subscribed to the Google Groups
"cfaussie" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cfaussie.
For more options, visit https://groups.google.com/groups/opt_out.
<<image001.png>>
