- left trim
- ltrim
- trim left
- TrimStart
1 C#[ | ]
C#
Copy
string str = "\t hello \n";
string trimmed = str.TrimStart();
// returns "hello \n"
2 Cmd[ | ]
bat
Copy
set str= hello world &rem
for /f "tokens=* delims= " %a in ("%str%") do set trimmed=%a
echo [%str%]
echo [%trimmed%]
REM shows [ hello world ]
REM shows [hello world ]
bat
Copy
set my_name= John Smith &rem
set trimmed=%my_name%
IF "%trimmed:~0,32%"==" " set trimmed=%trimmed:~32%
IF "%trimmed:~0,16%"==" " set trimmed=%trimmed:~16%
IF "%trimmed:~0,8%"==" " set trimmed=%trimmed:~8%
IF "%trimmed:~0,4%"==" " set trimmed=%trimmed:~4%
IF "%trimmed:~0,2%"==" " set trimmed=%trimmed:~2%
IF "%trimmed:~0,1%"==" " set trimmed=%trimmed:~1%
echo [%my_name%]
echo [%trimmed%]
REM shows [ John Smith ]
REM shows [John Smith ]
3 JavaScript[ | ]

JavaScript
Copy
var str = " HELLO ".replace(/^\s+/,'');
console.log("["+str+"]");
// [HELLO ]
JavaScript
Copy
String.prototype.ltrim=function(){return this.replace(/^\s+/,'');}
var str = " HELLO ";
var trimmed = str.ltrim();
4 PHP[ | ]
PHP
Copy
$trimmed = ltrim("\t hello \n"); // returns "hello \n"
5 Python[ | ]
Python
Copy
trimmed = "\t hello \n".lstrip() # returns "hello"
6 Ruby[ | ]
Ruby
Copy
trimmed = "\t hello \n".lstrip # returns "hello"
7 SQL[ | ]
7.1 MySQL[ | ]
MySQL
Copy
SELECT LTRIM( " hello world " );
# "hello world "
8 같이 보기[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.
리눅스 Python 2.7 컴파일 설치 ― …리눅스 Python 2.7 컴파일 설치 ― …리눅스 Python 2.7 컴파일 설치 ― …리눅스 Python 2.7 컴파일 설치 ― …리눅스 Python 2.7 컴파일 설치 ― Jmnote리눅스 Python 2.7 컴파일 설치 ― ㅇㅇㅇ미운코딩새끼 ― 승호 도령미운코딩새끼 ― 불탄고등어미운코딩새끼 ― 김레이미운코딩새끼 ― 호박이미운코딩새끼 ― Junhg0211미운코딩새끼 ― 김왼손미운코딩새끼 ― 용딘이미운코딩새끼 ―Pinkcrimson
유기농냠냠파이썬 ― 호박유기농냠냠파이썬 ― 이에스유기농냠냠파이썬 ― 이승현파이썬 global ― Jmnote파이썬 global ― John Jeong파이썬 global ― Jmnote파이썬 global ― John Jeong파이썬 global ― John Jeong파이썬 global ― John Jeong파이썬 global ― Jmnote파이썬 global ― John Jeong