種類
- インスタンスメソッド (115)
- 文書 (37)
クラス
- String (71)
モジュール
-
RDoc
:: Text (44)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 3
. 0 . 0 (4) - lstrip (11)
- lstrip! (11)
-
normalize
_ comment (11) -
parse
_ csv (5) - rstrip (11)
- rstrip! (11)
- strip! (11)
-
strip
_ hashes (11) -
strip
_ newlines (11) -
strip
_ stars (11) - 制御構造 (11)
- 正規表現 (11)
検索結果
先頭5件
-
String
# strip -> String (24337.0) -
文字列先頭と末尾の空白文字を全て取り除いた文字列を生成して返します。 空白文字の定義は " \t\r\n\f\v" です。 また、文字列右側からは "\0" も取り除きますが、 左側の "\0" は取り除きません。
...せん。
//emlist[例][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 #=> "a......bc"
p str #=> "\tabc\n" (元の文字列は変化しない)
//}
@see String#lstrip, String#rstrip... -
String
# strip! -> self | nil (12331.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
# lstrip -> String (12306.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
# rstrip -> String (12306.0) -
文字列の末尾にある空白文字を全て取り除いた新しい文字列を返します。 空白文字の定義は " \t\r\n\f\v\0" です。
...mlist[例][ruby]{
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,String#strip... -
RDoc
:: Text # strip _ hashes(text) -> String (12301.0) -
引数から各行の行頭の # を削除します。
引数から各行の行頭の # を削除します。
@param text 文字列を指定します。 -
RDoc
:: Text # strip _ newlines(text) -> String (12301.0) -
引数から先頭と末尾の改行を削除します。
引数から先頭と末尾の改行を削除します。
@param text 文字列を指定します。 -
RDoc
:: Text # strip _ stars(text) -> String (12301.0) -
引数から /* 〜 */ 形式のコメントを削除します。
引数から /* 〜 */ 形式のコメントを削除します。
@param text 文字列を指定します。 -
String
# lstrip! -> self | nil (12300.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
# rstrip! -> self | nil (12300.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... -
RDoc
:: Text # normalize _ comment(text) -> String (6212.0) -
引数から行頭のスペースや改行文字などを削除します。
...から行頭のスペースや改行文字などを削除します。
詳しくは [SEE ALSO] の各メソッドを参照してください。
@param text 文字列を指定します。
@see RDoc::Text#strip_hashes, RDoc::Text#expand_tabs,
RDoc::Text#flush_left, RDoc::Text#strip_newlines...