るりまサーチ (Ruby 2.3.0)

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

別のキーワード

  1. bigdecimal/util to_d
  2. float to_d
  3. rsa d
  4. rsa d=
  5. matrix d

クラス

キーワード

検索結果

StringScanner#matched -> String | nil (18310.0)

前回マッチした部分文字列を返します。 前回のマッチに失敗していると nil を返します。

...マッチした部分文字列を返します。
前回のマッチに失敗していると nil を返します。

//emlist[例][ruby]{
require 'strscan'

s = StringScanner.new('test string')
s.matched # => nil
s.scan(/\w+/) # => "test"
s.matched # => "test"
s.scan(/\w+/) # => nil
s.matched...

StringScanner#matched? -> bool (18310.0)

前回のマッチが成功していたら true を、 失敗していたら false を返します。

...前回のマッチが成功していたら true を、
失敗していたら false を返します。

//emlist[例][ruby]{
require 'strscan'

s = StringScanner.new('test string')
s.matched? # => false
s.scan(/\w+/) # => "test"
s.matched? # => true
s.scan(/\w+/) # => nil
s.matched? # => fal...

StringScanner#matched_size -> Integer | nil (18310.0)

前回マッチした部分文字列の長さを返します。 前回マッチに失敗していたら nil を返します。

...e 'strscan'

def run(encode)
utf8 = "\u{308B 3073 3044}" # るびい
s = StringScanner.new(utf8.encode(encode))
s.scan(/#{"\u{308B}".encode(encode)}/)
s.matched_size
end

p run("UTF-8") #=> 3
p run("EUC-JP") #=> 2
p run("Shift_Jis") #=> 2

//}

//emlist[例][ruby]{
require 'strscan'...

StringScanner#matchedsize -> Integer | nil (18310.0)

StringScanner#matched_size と同じです。

StringScanner#matched_size と同じです。

このメソッドは は将来のバージョンで削除される予定です。
代わりに StringScanner#matched_size を使ってください。

@see StringScanner#matched_size