어느 가을날의 전환점
JAVA|Function - LPad() : 문자열 좌측에 자릿수 채우기 본문
/**
* lpad 함수
*
* @param str 대상문자열, len 길이, addStr 대체문자
* @return 문자열
*/
public static String lpad(String str, int len, String addStr) {
String result = str;
int templen = len - result.length();
for (int i = 0; i < templen; i++){
result = addStr + result;
}
return result;
}
'Development' 카테고리의 다른 글
JAVA|Error - Incompatible operand types Integer and int (0) | 2010.02.03 |
---|---|
DEBUG|Debugging Tools for Windows - Overview (0) | 2010.01.22 |
JavaScript|브라우저(Browser) 닫기(Close) 스크립트 (0) | 2010.01.15 |
JAVA|Function - AddComma() : 숫자 자릿수 콤마 추가 (0) | 2009.12.29 |
JavaScript|Google Closure Tools (0) | 2009.11.18 |
Comments