Notice
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 |
Tags
- docker
- jupyterhub admin
- JupyterHub
- WebMercatorViewport
- crossorigin
- openlayers tooltip
- Deckgl Tooltip fixed position
- jupyterlab
- deckgl
- javascript lpad
- 다중팝업
- 오픈레이어스
- openlayers
- R kernel
- 지도
- ToolTip
- multiplePopup
- map
- 텍스트채우기
- 주피터허브
- 멀티툴팁
- openlayers crossorigin
- fitBounds
- Deckgl ToolTip
- javascript rpad
- getZoom
- 최적Zoom
- 다중툴팁
- cross-origin
- openlayers Popup
Archives
- Today
- Total
Map 개발자의 길
javaScript lpad, rpad 구현 본문
기능 구현에 앞서서
MySql에서 사용되는 LPAD, RPAD가 생각보다 자주사용하다 보니 javascript에서 사용하고 싶었다.
1. javaScript lpad, rpad
- 좌우로 자리수만큼 입력값 채우기
- 본개발자 코드는 자리수가 명확할떄 사용하기 때문에 별도로 입렵값에대한 에러 처리를 하지 않습니다.
//mysql query rpad() lpad() 구현
// 왼쪽 채움
String.prototype.lpad = function(padLength, padString) {
let arrTxt = this;
while (arrTxt.length < padLength)
arrTxt = padString + arrTxt;
return arrTxt;
}
// 오른쪽 채움
String.prototype.rpad = function(padLength, padString) {
let arrTxt = this;
while (arrTxt.length < padLength)
arrTxt += padString;
return arrTxt;
}
2.결과

반응형
Comments