I know it’s messy, but it works! (I hope, but I feel also it include error land mines.)
The memo for someone who need padding.
// [Routincall, input , output, padding number]
[RoutineDef, MyRtPadding //my routine padding
,
[VarSet, myString, myInput]
[VarSet, myReverseString, ""]
[VarSet, myNewString, ""]
[VarSet, counter, [StrLength, myString]-1]
[Loop, mydigits,
[VarSet, char, [StrExtract, myString, counter, counter]]
[IF, counter<0, //[StrLength, char]
//If
[VarSet, myReverseString, [StrMerge, myReverseString, "0"]]
, //Else
// merge the current character
[VarSet, myReverseString, [StrMerge, myReverseString, char]]
//decrement the counter
]
[VarDec, counter]
,n]
//[note,[StrMerge,"myReverseString is: ", myReverseString]] //debug
[VarSet, counter, [StrLength, myReverseString]]
[Loop, counter+1,
[VarSet, char, [StrExtract, myReverseString, counter, counter]]
// merge the current character
[VarSet, myNewString, [StrMerge, myNewString, char]]
//decrement the counter
[VarDec, counter]
,n]
[VarSet, myOutput, myNewString]
, myInput, myOutput,mydigits
]
[VarSet, testImput, "1234"]
[VarSet, testOutput, ""]
[RoutineCall,MyRtPadding, testImput, testOutput,6] // [Routincall, input , output, padding number]
[note,testOutput]