Very nice,

I love recursive functions, just don't see them often, makes me think of a lot 
of other uses for them I've never considered.

Also nice that railo lets you get the rest of the string without specifying the 
length, seems like a logical thing to do.

Regards
Dale Fraser

From: [email protected] [mailto:[email protected]] On Behalf Of 
Robin Hilliard
Sent: Thursday, 11 July 2013 2:41 PM
To: [email protected]
Subject: Re: [cfaussie] String Manipulation

Hi Dale,

Sorry I tested in Railo, it let me get away without the third argument. The 
arguments as the function calls itself look like this:

colonise("1Z0617756740260660","")
       colonise("0617756740260660","1Z")
              colonise("17756740260660","1Z:06")
                     colonise("756740260660","1Z:06:17")
                           ...

until the first argument is "", at which point the first part of the ternary 
expression triggers and returns the second argument.

Cheers,
Robin


 [cid:[email protected]]

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]<mailto:[email protected]>
web                          
www.rocketboots.com.au<http://www.rocketboots.com.au/>











On 11/07/2013, at 2:09 PM, Dale Fraser 
<[email protected]<mailto:[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]> 
[mailto:[email protected]<http://googlegroups.com>] On Behalf Of Robin 
Hilliard
Sent: Thursday, 11 July 2013 11:26 AM
To: [email protected]<mailto:[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

 <image001.png>

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]<mailto:[email protected]>
web                          
www.rocketboots.com.au<http://www.rocketboots.com.au/>











On 11/07/2013, at 12:28 AM, [email protected]<mailto:[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]<mailto:[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]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[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]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[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]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[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]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[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.


<<inline: image001.png>>

Reply via email to