views:

30

answers:

1

I am using

i = value.toBigInteger()
i.toString(32).toUpperCase()

to convert a 16 digit 'number' to characters for use in a serial

Is there any way to force this to use the A-Z + 2-7 notation rather than 0-9 + A-V??

+1  A: 

One option would be to re-implement the way BigInteger.toString( radix ) works (with Java 7, it calls java.math.Conversion.bigInteger2String which can be found here -- and as you can see, would be a large amount of work)

Another would be to use Groovy 1.7.3 and the new tr function to simply replace the chars in your string with those you want instead:

str.tr( '0-9A-V', 'A-Z0-7' )
tim_yates
Thats a fantastic Groovy method. Thanks.I will need to wait for the plug-in to Filemaker to be updated to this version then I can test it out...
john renfrew
mrhaki covered some usages of it here: http://mrhaki.blogspot.com/2010/06/groovy-goodness-text-translation.html
tim_yates