I would like to interface RPGLE with String.format which takes variable length arguments or an array, I also want to pass numbers as well as strings, so I will be using format like "hello %s, you are %d years old"
. Can someone give me some advide on how to prototype this in RPGLE?
UPDATE
It seems that some people were confused with the quesion. To make things clear, I want to prototype the following in RPGLE. Note that the second argument to the method is a varargs
parameter, so any number of arguments can be supplied! RPGLE definitely does not support this, but it does support *nopass
so this my be helpful in achieving the result I need.
String format = "|%1$-10s|%2$-10s|%3$-20s|\n";
System.out.format(format, "FirstName", "Init.", "LastName");
or
String.format(format, "FirstName", "Init.", "LastName");
I am not interested in how I can format strings in RPGLE, I want to prototype a java method.