るりまサーチ

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

別のキーワード

  1. _builtin end
  2. ripper end_seen?
  3. _builtin exclude_end?
  4. _builtin end_with?
  5. zlib end

ライブラリ

キーワード

検索結果

<< 1 2 > >>

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

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

...ずれかであるとき 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?...
...ます。

@
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_...

String#prepend(*arguments) -> String (6109.0)

複数の文字列を先頭に破壊的に追加します。

...複数の文字列を先頭に破壊的に追加します。

@
param arguments 追加したい文字列を指定します。

//emlist[例][ruby]{
a = "!!!"
a.prepend # => "!!!"
a # => "!!!"

a = "!!!"
a.prepend "hello ", "world" # => "hello world!!!"
a # => "hello...

String#prepend(other_str) -> String (6109.0)

文字列 other_str を先頭に破壊的に追加します。

...文字列 other_str を先頭に破壊的に追加します。

@
param other_str 追加したい文字列を指定します。

//emlist[例][ruby]{
a = "world"
a.prepend("hello ") # => "hello world"
a # => "hello world"
//}...

String#append_as_bytes(*objects) -> self (6108.0)

引数で与えたオブジェクトをバイト列として、self に破壊的に連結します。

...II-8BIT)>
s.append_as_bytes("い") # => "\xE3\x81\x82\xE3\x81\x84"

# s << "い" では連結できない
s << "い" # => "incompatible character encodings: BINARY (ASCII-8BIT) and UTF-8 (Encoding::CompatibilityError)
//}

//emlist[引数で整数を渡す例][ruby]{
t = ""
t.append_as_bytes(0x61)...
...# => "a"
t.append_as_bytes(0x3062) # => "ab"
//}

@
see String#<<, String#concat...

String#prepend(other_str) -> String (6108.0)

文字列 other_str を先頭に破壊的に追加します。

...文字列 other_str を先頭に破壊的に追加します。

@
param other_str 追加したい文字列を指定します。

//emlist[例][ruby]{
a = "world"
a.prepend("hello ") # => "hello world"
a # => "hello world"
//}...

絞り込み条件を変える

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

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

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

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


以下にあげるものは、Array#pack、String#unpack
のテンプレート文字の一覧です。テンプレート文...
...、整数サイズ非依存 (ネットワークプロトコルなどに適切)
//emlist{
n: big endian unsigned 16bit
N: big endian unsigned 32bit
v: little endian unsigned 16bit
V: little endian unsigned 32bit
//}

: エンディアン依存、整数サイズ依存 (C の構造体などに...
...に適切)
//emlist{
S>: big endian unsigned 16bit(nと同じ)
s>: big endian int16_t
s!>: big endian signed short
l<: little endian int32_t
l!<: little endian signed long
//}

=== 各テンプレート文字の説明

説明中、Array#pack と String#unpack で違いのあるものは...
...ックし、
それらの要素を含む配列を返します。

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


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

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

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

...

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

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

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

@
see String#chomp!
@
see String#chop!
@
see String#d...
...elete_prefix!
@
see String#delete_suffix
@
see String#end_with?...

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

文字列の末尾から 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#==(other) -> bool (32.0)

other が文字列の場合、String#eql? と同様に文字列の内容を比較します。

...合、String#eql? と同様に文字列の内容を比較します。

other が文字列でない場合、
other.to_str が定義されていれば
other == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ false を返します。

@
param...
...
@
return true か false

//emlist[例][ruby]{
string
like = Object.new

def stringlike.==(other)
"string" == other
end


p "string".eql?(stringlike) #=> false
p "string" == stringlike #=> false

def stringlike.to_str
raise
end


p "string".eql?(stringlike) #=> false
p "string" == stringl...
...ike #=> true
//}

@
see String#eql?...

String#===(other) -> bool (32.0)

other が文字列の場合、String#eql? と同様に文字列の内容を比較します。

...合、String#eql? と同様に文字列の内容を比較します。

other が文字列でない場合、
other.to_str が定義されていれば
other == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ false を返します。

@
param...
...
@
return true か false

//emlist[例][ruby]{
string
like = Object.new

def stringlike.==(other)
"string" == other
end


p "string".eql?(stringlike) #=> false
p "string" == stringlike #=> false

def stringlike.to_str
raise
end


p "string".eql?(stringlike) #=> false
p "string" == stringl...
...ike #=> true
//}

@
see String#eql?...

絞り込み条件を変える

String#each_line(rs = $/, chomp: false) -> Enumerator (26.0)

文字列中の各行に対して繰り返します。 行の区切りは rs に指定した文字列で、 そのデフォルト値は変数 $/ の値です。 各 line には区切りの文字列も含みます。

...割します
(つまり空行で分割します)。

@
param rs 行末を示す文字列
@
param chomp true を指定すると各行の末尾から rs を取り除きます。

//emlist[例][ruby]{
"aa\nbb\ncc\n".each_line do |line|
p line
end

# => "aa\n"
# => "bb\n"
# => "cc\n"

p "a...
...a\nbb\ncc\n".lines.to_a # => ["aa\n", "bb\n", "cc\n"]
p "aa\n".lines.to_a # => ["aa\n"]
p "".lines.to_a # => []

s = "aa\nbb\ncc\n"
p s.lines("\n").to_a #=> ["aa\n", "bb\n", "cc\n"]
p s.lines("bb").to_a #=> ["aa\nbb", "\ncc\n"]
//}

@
see String#lines...

String#each_line(rs = $/, chomp: false) {|line| ... } -> self (26.0)

文字列中の各行に対して繰り返します。 行の区切りは rs に指定した文字列で、 そのデフォルト値は変数 $/ の値です。 各 line には区切りの文字列も含みます。

...割します
(つまり空行で分割します)。

@
param rs 行末を示す文字列
@
param chomp true を指定すると各行の末尾から rs を取り除きます。

//emlist[例][ruby]{
"aa\nbb\ncc\n".each_line do |line|
p line
end

# => "aa\n"
# => "bb\n"
# => "cc\n"

p "a...
...a\nbb\ncc\n".lines.to_a # => ["aa\n", "bb\n", "cc\n"]
p "aa\n".lines.to_a # => ["aa\n"]
p "".lines.to_a # => []

s = "aa\nbb\ncc\n"
p s.lines("\n").to_a #=> ["aa\n", "bb\n", "cc\n"]
p s.lines("bb").to_a #=> ["aa\nbb", "\ncc\n"]
//}

@
see String#lines...
<< 1 2 > >>