October 13, 201312 yr 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!
October 13, 201312 yr 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.
October 13, 201312 yr 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.
October 17, 201312 yr Author 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 ("¶")
Create an account or sign in to comment