함수 rtrim()

(RTRIM()에서 넘어옴)

1 개요[ | ]

right trim
rtrim
TrimEnd
output = rtrim(input)
  • input
"\t  hello  \n"
  • output
"\t  hello"

2 C#[ | ]

string input = "\t  hello  \n";
string output = input.TrimEnd();
// returns "\t  hello"

3 Cmd[ | ]

set my_name=      John Smith        &rem
set trimmed=%my_name%
IF "%trimmed:~-32%"=="                                " set trimmed=%trimmed:~0,-32%
IF "%trimmed:~-16%"=="                " set trimmed=%trimmed:~0,-16%
IF "%trimmed:~-8%"=="        " set trimmed=%trimmed:~0,-8%
IF "%trimmed:~-4%"=="    " set trimmed=%trimmed:~0,-4%
IF "%trimmed:~-2%"=="  " set trimmed=%trimmed:~0,-2%
IF "%trimmed:~-1%"==" " set trimmed=%trimmed:~0,-1%
echo [%my_name%]
echo [%trimmed%]
REM [      John Smith        ]
REM [      John Smith]

4 JavaScript[ | ]

String.prototype.rtrim = function() {
  return this.replace(/\s+$/,'');
}

var input = "\t  hello  \n";
var output = input.rtrim();
function rtrim() {
  return this.replace(/\s+$/,'');
}

var input = "\t  hello  \n";
var output = rtrim(input);

5 PHP[ | ]

$input = "\t  hello  \n"; 
$output = rtrim($input );
$input = "\t  hello  \n"; 
$output = chop($input ); // alias

6 Python[ | ]

trimmed = "\t  hello  \n".rstrip() # returns "hello"

7 Ruby[ | ]

trimmed = "\t  hello  \n".rstrip # returns "hello"

8 SQL[ | ]

8.1 MySQL[ | ]

SELECT RTRIM( "  hello world  " );
# "  hello world"

9 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}