java实现oracle函数rpad和lpad
import junit.framework.TestCase;public class StringTest extends TestCase{public void ntestRpad(){System.out.println(rpad("1",3,"0"));}public void testLpad(){System.out.println(lpad("1",3,"0"));}private String lpad(String s, int n, String replace) {while (s.length() < n) {s = replace+s;}return s;}private String rpad(String s, int n, String replace) {while (s.length() < n) {s = s+replace;}return s;}}