るりまサーチ

最速Rubyリファレンスマニュアル検索!
39件ヒット [1-39件を表示] (0.041秒)
トップページ > クエリ:tr[x] > クエリ:delete_prefix[x]

別のキーワード

  1. _builtin delete
  2. _builtin delete_if
  3. cgi delete
  4. pop delete_all
  5. pop3 delete_all

ライブラリ

クラス

検索結果

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

文字列の先頭から 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_prefix!(prefix) -> self | nil (9119.0)

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

...ら削除する文字列を指定します。

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

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

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

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

文字列の末尾から 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#start_with?(*prefixes) -> bool (3012.0)

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

...あるとき true を返します。

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

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

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

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

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

...ます。

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

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

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

絞り込み条件を変える

NEWS for Ruby 3.0.0 (18.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...リンク先を参照してください。

== 言語仕様の変更

* Keyword arguments are now separated from positional arguments.
Code that resulted in deprecation warnings in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argu...
...redesigned. [EXPERIMENTAL]
* `=>` is added. It can be used like a rightward assignment.
17260
* `in` is changed to return `true` or `false`. 17371

//emlist{
0 => a
p a #=> 0

{b: 0, c: 1} => {b:}
p b #=> 0
//}

//emlist{
# version 3.0
0 in 1 #=> false

# version 2.7
0 in 1...
...String
* The following methods now return or yield String instances instead of subclass instances when called on subclass instances: 10845
* String#*
* String#capitalize
* String#center
* String#chomp
* String#chop
* String#delete
* String#delete_prefix...