るりまサーチ

最速Rubyリファレンスマニュアル検索!
176件ヒット [1-100件を表示] (0.198秒)
トップページ > クラス:String[x] > クエリ:_builtin[x] > クエリ:end[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

キーワード

検索結果

<< 1 2 > >>

String#end_with?(*strs) -> bool (14120.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_suffix!...

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

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

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

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

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

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

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

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

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

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

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

String#unpack(template) -> Array (8043.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 で違いのあるものは...
...m template pack テンプレート文字列
@return オブジェクトの配列


以下にあげるものは、Array#pack、String#unpack、String#unpack1
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を続けることがで...

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

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

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

other が文字列でない場合、
other.to_str が定義されていれば
other == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ false...
...st[例][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" == stringlike #=> true
//}

@see String#eql?...

絞り込み条件を変える

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

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

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

other が文字列でない場合、
other.to_str が定義されていれば
other == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ false...
...st[例][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" == stringlike #=> true
//}

@see String#eql?...

String#each_byte -> Enumerator (8013.0)

文字列の各バイトに対して繰り返します。

...文字列の各バイトに対して繰り返します。

//emlist[例][ruby]{
"str".each_byte do |byte|
p byte
end

# => 115
# => 116
# => 114

"あ".each_byte do |byte|
p byte
end

# => 227
# => 129
# => 130
//}

@see String#bytes...

String#each_byte {|byte| ... } -> self (8013.0)

文字列の各バイトに対して繰り返します。

...文字列の各バイトに対して繰り返します。

//emlist[例][ruby]{
"str".each_byte do |byte|
p byte
end

# => 115
# => 116
# => 114

"あ".each_byte do |byte|
p byte
end

# => 227
# => 129
# => 130
//}

@see String#bytes...

String#sum(bits = 16) -> Integer (8013.0)

文字列の bits ビットのチェックサムを計算します。

...+= c }
return 0 if sum == 0
sum & ((1 << bits) - 1)
end

//}

例えば以下のコードで UNIX System V の
sum(1) コマンドと同じ値が得られます。

//emlist[例][ruby]{
sum = 0
ARGF.each_line do |line|
sum += line.sum
end

sum %= 65536
//}

@param bits チェックサムの...

String#upto(max, exclusive = false) {|s| ... } -> self (8013.0)

self から始めて max まで 「次の文字列」を順番にブロックに与えて繰り返します。 「次」の定義については String#succ を参照してください。

...次」の定義については String#succ を参照してください。

たとえば以下のコードは a, b, c, ... z, aa, ... az, ..., za を
出力します。

//emlist[][ruby]{
("a" .. "za").each do |str|
puts str
end

'a'.upto('za') do |str|
puts str
end

//}

@param max 繰り返し...

絞り込み条件を変える

<< 1 2 > >>