Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 4112 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I'm wondering if someone could suggest a calculation to convert a list of numbers into a list of two digit numbers. 

 

For example: 

"1¶3¶9¶14¶22"

would be converted to..

"01¶03¶09¶14¶22"

 

In other words the single digit numbers would have a "0" placed in front. 

 

Thanks!

Posted

Well, there are only 10 single-digit numbers (9 if you exclude 0) - so substituting them with their two-digit equivalents would seem like the cheapest way to go.

Posted

Just to clarify, I meant a straightforward hard-coded substitute, e.g. =

Let ( [
sub = Substitute ( ¶ & listOfValues & ¶ ;
[ "¶1¶" ; "¶01¶" ] ;
[ "¶2¶" ; "¶02¶" ] ;
[ "¶3¶" ; "¶03¶" ] ;
...
[ "¶9¶" ; "¶09¶" ] )
] ;
Middle ( sub ; 2 ; Length ( sub ) - 2 )
)

The custom function is designed for cases where the substitution pairs are not known in advance - for example, when there is a table of dictionary terms that the users can modify.

  • Like 2
Posted

Awesome, thanks for the tip!  I never would have figured out that last part:

Middle ( sub ; 2 ; Length ( sub ) - 2 )

 

Without it, the substitute ignores the first value because it is not preceded by a newline character ("¶")

This topic is 4112 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.