String padding functions: lpad(), rpad() v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Mon, 23 Dec 2013 11:52:49 +0100
branchv_0
changeset 38ff5bbc06ed29
parent 37 9e6f8e5d5f98
child 39 be8db46a38c3
String padding functions: lpad(), rpad()
java/sql-dk/src/info/globalcode/sql/dk/Functions.java
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/Functions.java	Mon Dec 23 11:50:24 2013 +0100
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/Functions.java	Mon Dec 23 11:52:49 2013 +0100
     1.3 @@ -118,4 +118,12 @@
     1.4  			}
     1.5  		}
     1.6  	}
     1.7 +
     1.8 +	public static String rpad(String s, int n) {
     1.9 +		return String.format("%1$-" + n + "s", s);
    1.10 +	}
    1.11 +
    1.12 +	public static String lpad(String s, int n) {
    1.13 +		return String.format("%1$" + n + "s", s);
    1.14 +	}
    1.15  }