るりまサーチ

最速Rubyリファレンスマニュアル検索!
116件ヒット [1-100件を表示] (0.099秒)
トップページ > クエリ:ruby[x] > 種類:インスタンスメソッド[x] > クエリ:i[x] > クラス:String[x] > クエリ:@[x] > クエリ:delete[x]

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

<< 1 2 > >>

String#delete(*strs) -> String (21239.0)

self から strs に含まれる文字を取り除いた文字列を生成して返します。

...合は、
すべての引数にマッチする文字だけが削除されます。

@
param strs 削除する文字列を示す文字列 (のリスト)

//emlist[例][ruby]{
p "123456789".delete("2378") #=> "14569"
p "123456789".delete("2-8", "^4-6") #=> "14569"
//}

@
see String#delete!...

String#delete_suffix!(suffix) -> self | nil (12375.0)

self の末尾から破壊的に suffix を削除します。

...fix を削除します。

@
param suffix 末尾から削除する文字列を指定します。

@
return 削除した場合は self、変化しなかった場合は nil

//emlist[][ruby]{
"hello".delete_suffix!("llo") # => "he"
"hello".delete_suffix!("hel") # => nil
//}

@
see String#chomp!
@
see Stri...
...ng#chop!
@
see String#delete_prefix!
@
see String#delete_suffix
@
see String#end_with?...

String#delete_suffix(suffix) -> String (12375.0)

文字列の末尾から suffix を削除した文字列のコピーを返します。

...ら suffix を削除した文字列のコピーを返します。

@
param suffix 末尾から削除する文字列を指定します。

@
return 文字列の末尾から suffix を削除した文字列のコピー

//emlist[][ruby]{
"hello".delete_suffix("llo") # => "he"
"hello".delete_suffix("hel")...
...# => "hello"
//}

@
see String#chomp
@
see String#chop
@
see String#delete_prefix
@
see String#delete_suffix!
@
see String#end_with?...

String#delete_prefix!(prefix) -> self | nil (12363.0)

self の先頭から破壊的に prefix を削除します。

...fix を削除します。

@
param prefix 先頭から削除する文字列を指定します。

@
return 削除した場合は self、変化しなかった場合は nil

//emlist[][ruby]{
"hello".delete_prefix!("hel") # => "lo"
"hello".delete_prefix!("llo") # => nil
//}

@
see String#delete_prefix
@
s...
...ee String#delete_suffix!
@
see String#start_with?...

String#delete_prefix(prefix) -> String (12363.0)

文字列の先頭から prefix を削除した文字列のコピーを返します。

...ら prefix を削除した文字列のコピーを返します。

@
param prefix 先頭から削除する文字列を指定します。

@
return 文字列の先頭から prefix を削除した文字列のコピー

//emlist[][ruby]{
"hello".delete_prefix("hel") # => "lo"
"hello".delete_prefix("llo")...
...# => "hello"
//}

@
see String#delete_prefix!
@
see String#delete_suffix
@
see String#start_with?...

絞り込み条件を変える

String#delete!(*strs) -> self | nil (9251.0)

self から strs に含まれる文字を破壊的に取り除きます。

...だけが削除されます。

@
return 通常は self を返しますが、何も変更が起こらなかった場合は nil を返します。

@
param strs 削除する文字列を示す文字列 (のリスト)

//emlist[例][ruby]{
str = "123456789"
p str.delete!("2378") #=> "14569"
p...
...str #=> "14569"

str = "123456789"
p str.delete!("2-8", "^4-6") #=> "14569"
p str #=> "14569"

str = "abc"
p str.delete!("2378") #=> "nil"
p str #=> "abc"
//}

@
see String#delete...

String#end_with?(*strs) -> bool (6138.0)

self の末尾が strs のいずれかであるとき true を返します。

...

@
param strs パターンを表す文字列 (のリスト)

//emlist[例][ruby]{
"string".end_with?("ing") # => true
"string".end_with?("str") # => false
"string".end_with?("str", "ing") # => true
//}

@
see String#start_with?
@
see String#delete_suffix, String#delete_suffix!...

String#start_with?(*prefixes) -> bool (6138.0)

self の先頭が prefixes のいずれかであるとき true を返します。

...が prefixes のいずれかであるとき true を返します。

@
param prefixes パターンを表す文字列または正規表現 (のリスト)

//emlist[例][ruby]{
"string".start_with?("str") # => true
"string".start_with?("ing") # => false
"string".start_with?("ing", "st...
...r") # => true
"string".start_with?(/\w/) # => true
"string".start_with?(/\d/) # => false
//}

@
see String#end_with?
@
see String#delete_prefix, String#delete_prefix!...

String#unpack(template) -> Array (3788.0)

Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。

...アンパックし、
それらの要素を含む配列を返します。

@
param template pack テンプレート文字列
@
return オブジェクトの配列


以下にあげるものは、Array#pack、String#unpack
のテンプレート文字の一覧です。テンプレート文...
...を表すこともできます。

長さの意味はテンプレート文字により異なりますが大抵、
"iiii"
のように連続するテンプレート文字は
"i4"
と書き換えることができます。

テンプレート文字列中の空白類は無視されます。
また...
...ong のサイズにすることもできます。

i
, I (int)のサイズは常にシステム依存であり、n, N, v, V
のサイズは常にシステム依存ではない(!をつけられない)ことに注意してください。

つまり、IO#ioctl などで C の構造体を渡すときの...
...ックし、
それらの要素を含む配列を返します。

@
param template pack テンプレート文字列
@
return オブジェクトの配列


以下にあげるものは、Array#pack、String#unpack、String#unpack1
のテンプレート文字の一覧です。テンプレ...

String#chomp!(rs = $/) -> self | nil (3138.0)

self の末尾から rs で指定する改行コードを取り除きます。 ただし rs が "\n" ($/ のデフォルト値) のときは、 実行環境によらず "\r", "\r\n", "\n" のすべてを改行コードとみなして取り除きます。

...

rs に nil を指定した場合、このメソッドは何もしません。

rs に空文字列 ("") を指定した場合は「パラグラフモード」になり、
実行環境によらず末尾の連続する改行コード("\r\n", "\n")をすべて取り除きます。

@
return chomp!...
...は nil を返します。

//emlist[例][ruby]{
buf = "string\n"
buf.chomp! # => nil
p buf # => "string"

$/ = "\n" # デフォルトと同じ
p "foo\r".chomp! # => "foo"
p "foo\r\n".chomp! # => "foo"
p "foo\n".chomp! # => "foo"
p "foo\n\r".chomp! # => "foo\n"

buf = "string\n"
buf...
....chomp!(nil) # => nil
p buf # => "string\n"

p "foo\r\n\n".chomp!("") # => "foo"
p "foo\n\r\n".chomp!("") # => "foo"
p "foo\n\r\r".chomp!("") # => nil
//}

@
see String#chomp
@
see String#chop!
@
see String#delete_suffix!...

絞り込み条件を変える

String#chop! -> self | nil (3138.0)

文字列の最後の文字を取り除きます。 ただし、終端が "\r\n" であればその 2 文字を取り除きます。

...ます。

@
return chop! は self を変更して返しますが、取り除く文字がなかった場合は nil を返します。

//emlist[例][ruby]{
str = "string\r\n"
ret = str.chop!
ret # => "string"
str # => "string"
str.chop! # => "strin"
"".cho...
...p! # => nil
//}

@
see String#chomp!
@
see String#chop
@
see String#delete_suffix!...
<< 1 2 > >>