るりまサーチ

最速Rubyリファレンスマニュアル検索!
2130件ヒット [501-600件を表示] (0.137秒)

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. t61string new
  4. matrix t
  5. fiddle type_size_t

ライブラリ

キーワード

検索結果

<< < ... 4 5 6 7 8 ... > >>

String#codepoints -> [Integer] (15132.0)

文字列の各コードポイントの配列を返します。(self.each_codepoint.to_a と同じです)

...odepoint.to_a と同じです)

//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".codepoints
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
//}

ブロックが指定された場合は String#each_codepoint と同じように動作します。

Ruby
2.6 までは deprecated の...
...警告が出ますが、Ruby 2.7 で警告は削除されました。

@see String#each_codepoint...

String#codepoints {|codepoint| block } -> self (15132.0)

文字列の各コードポイントの配列を返します。(self.each_codepoint.to_a と同じです)

...odepoint.to_a と同じです)

//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".codepoints
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
//}

ブロックが指定された場合は String#each_codepoint と同じように動作します。

Ruby
2.6 までは deprecated の...
...警告が出ますが、Ruby 2.7 で警告は削除されました。

@see String#each_codepoint...

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

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

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

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

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

@see String#sta...
...rt_with?...

String#start_with?(*strs) -> bool (15132.0)

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

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

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

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

@see Str...
...ing#end_with?...

String#delete_prefix!(prefix) -> self | nil (15126.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#match?(regexp, pos = 0) -> bool (15126.0)

regexp.match?(self, pos) と同じです。 regexp が文字列の場合は、正規表現にコンパイルします。 詳しくは Regexp#match? を参照してください。

...regexp.match?(self, pos) と同じです。
regexp が文字列の場合は、正規表現にコンパイルします。
詳しくは Regexp#match? を参照してください。

//emlist[例][ruby]{
"Ruby".match?(/R.../) #=> true
"Ruby".match?(/R.../, 1) #=> false
"Ruby".match?(/P.../) #=>...
...false
$& #=> nil
//}

@see Regexp#match?, Symbol#match?...

String#upto(max, exclusive = false) {|s| ... } -> self (15124.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 繰り...

String#each_grapheme_cluster -> Enumerator (15120.0)

文字列の書記素クラスタに対して繰り返します。

...

String
#each_char と違って、
Unicode Standard Annex #29 (https://unicode.org/reports/tr29/)
で定義された書記素クラスタに対して繰り返します。

//emlist[例][ruby]{
"a\u0300".each_char.to_a.size # => 2
"a\u0300".each_grapheme_cluster.to_a.size # => 1
//}

@see String#g...
...rapheme_clusters...

String#match(regexp, pos = 0) {|m| ... } -> object (15120.0)

regexp.match(self, pos) と同じです。 regexp が文字列の場合は、正規表現にコンパイルします。 詳しくは Regexp#match を参照してください。

...regexp.match(self, pos) と同じです。
regexp が文字列の場合は、正規表現にコンパイルします。
詳しくは Regexp#match を参照してください。

//emlist[例: regexp のみの場合][ruby]{
'hello'.match('(.)\1') # => #<MatchData "ll" 1:"l">
'hello'.match('(.)\1...
...ll"
'hello'.match(/(.)\1/)[0] # => "ll"
'hello'.match('xx') # => nil
//}

//emlist[例: regexp, pos を指定した場合][ruby]{
'hoge hige hege bar'.match('h.ge', 0) # => #<MatchData "hoge">
'hoge hige hege bar'.match('h.ge', 1) # => #<MatchData "hige">
//}

//emlist[例: ブロ...
...ックを指定した場合][ruby]{
'hello'.match('(.)\1'){|e|"match #{$1}"} # => "match l"
'hello'.match('xx'){|e|"match #{$1}"} # マッチしないためブロックは実行されない
//}

@see Regexp#match, Symbol#match...

String#to_c -> Complex (15120.0)

自身を複素数 (Complex) に変換した結果を返します。

...list[例][ruby]{
'9'.to_c # => (9+0i)
'2.5'.to_c # => (2.5+0i)
'2.5/1'.to_c # => ((5/2)+0i)
'-3/2'.to_c # => ((-3/2)+0i)
'-i'.to_c # => (0-1i)
'45i'.to_c # => (0+45i)
'3-4i'.to_c # => (3-4i)
'-4e2-4e-2i'.to_c # => (-400.0-0.04i)
'-0.0-0.0i'.to_...
...c # => (-0.0-0.0i)
'1/2+3/4i'.to_c # => ((1/2)+(3/4)*i)
'10@10'.to_c # => (-8.390715290764524-5.440211108893697i)
'-0.3_3'.to_c # => (-0.33+0i)
" \t\r\n5+3i".to_c # => (5+3i)
'5+3ix'.to_c # => (5+3i)
'ruby'.to_c # => (0+0i)
//}...

絞り込み条件を変える

String#to_r -> Rational (15120.0)

自身を有理数(Rational)に変換した結果を返します。

...自身を有理数(Rational)に変換した結果を返します。

Kernel.#Rational に文字列を指定した時のように、以下のいずれかの形
式で指定します。

* "1/3" のような分数の形式
* "0.3" のような10進数の形式
* "0.3E0" のような x.xEn の形...
...スコアで繋いだ形式

//emlist[例][ruby]{
' 2 '.to_r # => (2/1)
'1/3'.to_r # => (1/3)
'-9.2'.to_r # => (-46/5)
'-9.2E2'.to_r # => (-920/1)
'1_234_567'.to_r # => (1234567/1)
'1_234/5_678'.to_r # => (617/2839)
//}

Kernel.#Rational に文字列を指定した時...
...//emlist[][ruby]{
'21 june 09'.to_r # => (21/1)
'21/06/09'.to_r # => (7/2) # 21/6 を約分して 7/2。
//}

変換できないような文字列を指定した場合は 0/1 を返します。

//emlist[][ruby]{
'foo'.to_r # => (0/1)
''.to_r # => (0/1)
'bwv 1079'.to_r #...
<< < ... 4 5 6 7 8 ... > >>