るりまサーチ

最速Rubyリファレンスマニュアル検索!
66件ヒット [1-66件を表示] (0.144秒)

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. dsa p
  5. matrix p

ライブラリ

クラス

キーワード

検索結果

String#lstrip -> String (24238.0)

文字列の先頭にある空白文字を全て取り除いた新しい文字列を返します。 空白文字の定義は " \t\r\n\f\v" です。

...頭にある空白文字を全て取り除いた新しい文字列を返します。
空白文字の定義は " \t\r\n\f\v" です。

//emlist[例][ruby]{
p
" abc\n".lstrip #=> "abc\n"
p
"\t abc\n".lstrip #=> "abc\n"
p
"abc\n".lstrip #=> "abc\n"
//}

@see String#strip, String#rstrip...

String#lstrip! -> self | nil (12244.0)

文字列の先頭にある空白文字を全て破壊的に取り除きます。 空白文字の定義は " \t\r\n\f\v" です。

..." \t\r\n\f\v" です。

lstrip
! は self を変更して返します。
ただし取り除く空白がなかったときは nil を返します。

//emlist[例][ruby]{
str = " abc"
p
str.lstrip! # => "abc"
p
str # => "abc"

str = "abc"
p
str.lstrip! # => nil
p
str # => "ab...

String#strip -> String (6149.0)

文字列先頭と末尾の空白文字を全て取り除いた文字列を生成して返します。 空白文字の定義は " \t\r\n\f\v" です。 また、文字列右側からは "\0" も取り除きますが、 左側の "\0" は取り除きません。

...t[例][ruby]{
p
" abc \r\n".strip #=> "abc"
p
"abc\n".strip #=> "abc"
p
" abc".strip #=> "abc"
p
"abc".strip #=> "abc"
p
" \0 abc \0".strip # => "\000 abc" # 右側のみ "\0" も取り除く

str = "\tabc\n"
p
str.strip #=> "abc"
p
str...
...#=> "\tabc\n" (元の文字列は変化しない)
//}

@see String#lstrip, String#rstrip...

String#rstrip -> String (6143.0)

文字列の末尾にある空白文字を全て取り除いた新しい文字列を返します。 空白文字の定義は " \t\r\n\f\v\0" です。

...uby]{
p
" abc\n".rstrip #=> " abc"
p
" abc \t\r\n\0".rstrip #=> " abc"
p
" abc".rstrip #=> " abc"
p
" abc\0 ".rstrip #=> " abc"

str = "abc\n"
p
str.rstrip #=> "abc"
p
str #=> "abc\n" (元の文字列は変化しない)
//}

@see String#lstrip,Stri...
...ng#strip...

String#strip! -> self | nil (6137.0)

先頭と末尾の空白文字を全て破壊的に取り除きます。 空白文字の定義は " \t\r\n\f\v" です。 また、文字列右側からは "\0" も取り除きますが、 左側の "\0" は取り除きません。

...ません。

strip! は、内容を変更した self を返します。
ただし取り除く空白がなかったときは nil を返します。

//emlist[例][ruby]{
str = " abc\r\n"
p
str.strip! #=> "abc"
p
str #=> "abc"

str = "abc"
p
str.strip! #=> nil
p
str #=>...
..."abc"

str = " \0 abc \0"
str.strip!
p
str # => "\000 abc" # 右側の "\0" のみ取り除かれる
//}

@see String#strip, String#lstrip...

絞り込み条件を変える

String#rstrip! -> self | nil (6131.0)

文字列の末尾にある空白文字を全て破壊的に取り除きます。 空白文字の定義は " \t\r\n\f\v\0" です。

...的に取り除きます。
空白文字の定義は " \t\r\n\f\v\0" です。

//emlist[例][ruby]{
str = " abc\n"
p
str.rstrip! # => " abc"
p
str # => " abc"

str = " abc \r\n\t\v\0"
p
str.rstrip! # => " abc"
p
str # => " abc"
//}

@see String#rstrip, String#lstrip...