Topic: Array operations

Per a discussion from here:
http://ketarin.canneverbe.com/forum/vie … php?id=150


I'd really find it useful to be able to perform mass replacements on a variable by passing in an array of "find" and an array of "replace" values. This would work something like this:

{myvar:arrayreplace:,:Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec:01,02,03,04,05,06,07,08,09,10,11,12}

Where "arrayreplace" is the function name, "," is the delimiter, "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec" is the find array, and "01,02,03,04,05,06,07,08,09,10,11,12" is the replacement array.

{myvar:arrayreplace:delimiter:findarray:replacearray}

Pushing that against the following values would yield these respective results:

2010-May-08 = 2010-05-08
Dec 11, 2004 = 12 11, 2004
I hate June bugs = I hate 06e bugs

Here's another place it would come in handy:

{myvar:arrayreplace:|:, Build| Build | part | beta | b:.|.|.|.|-}

This would convert:
Picasa 3.6, Build 3622 = Picasa 3.6.3622
Audacity 1.3 beta 22 = Audacity 1.3.22
MyApp 2.9 b4 = MyApp 2.9-4

Last edited by shawn (2010-05-30 20:15:24)

Re: Array operations

hi
have u  tried regexreplace?

Re: Array operations

To my knowledge, regexreplace provides several search strings, but only one *replacement* string. Am I misunderstanding it's operation? I don't see how it could be used to replace the month *name* with it's numeric equivalent in a single operation.

Re: Array operations

Seems interesting, will consider that.

Re: Array operations

Ya interesting indeed looks like u got it smile
Thanks!

Re: Array operations

AWESOME! I can't wait 'til tomorrow when I get to find and then rewrite a half dozen searches. This is going to save me so much time and variables.