189件ヒット
[1-100件を表示]
(0.112秒)
クラス
-
Scanf
:: FormatSpecifier (12) -
Scanf
:: FormatString (12) - String (44)
- StringScanner (121)
キーワード
- check (11)
-
check
_ until (11) - clear (11)
- gsub (44)
- matched? (11)
-
matched
_ count (6) -
matched
_ size (11) -
matched
_ string (6) - matchedsize (11)
- prune (6)
- reset (11)
-
scan
_ until (11) -
skip
_ until (11) - terminate (11)
検索結果
先頭5件
-
StringScanner
# matched -> String | nil (21144.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 # => nil
s.scan(/\s+/) # => " "
s.matched # => " "
//}... -
Scanf
:: FormatSpecifier # matched (21102.0) -
@todo
@todo -
StringScanner
# matched? -> bool (9144.0) -
前回のマッチが成功していたら true を、 失敗していたら false を返します。
...失敗していたら 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? # => false
s.scan(/\s+/) # => " "
s.matched? # => true
//}... -
StringScanner
# matched _ size -> Integer | nil (9144.0) -
前回マッチした部分文字列の長さを返します。 前回マッチに失敗していたら nil を返します。
...'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'
s......= StringScanner.new('test string')
s.matched_size # => nil
s.scan(/\w+/) # => "test"
s.matched_size # => 4
s.scan(/\w+/) # => nil
s.matched_size # => nil
//}... -
StringScanner
# matchedsize -> Integer | nil (9129.0) -
StringScanner#matched_size と同じです。
...StringScanner#matched_size と同じです。
このメソッドは は将来のバージョンで削除される予定です。
代わりに StringScanner#matched_size を使ってください。
@see StringScanner#matched_size... -
StringScanner
# scan _ until(regexp) -> String | nil (9114.0) -
regexp で指定された正規表現とマッチするまで文字列をスキャンします。 マッチに成功したらスキャンポインタを進めて、 スキャン開始位置からマッチ部分の末尾までの部分文字列を返します。 マッチに失敗したら nil を返します。
...を返します。
@param regexp マッチに用いる正規表現を指定します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.scan_until(/str/) # => "test str"
s.matched # => "str"
s.pos # => 8
s.pre_match # => "test "
//}... -
Scanf
:: FormatSpecifier # matched _ string (9102.0) -
@todo
@todo -
Scanf
:: FormatString # matched _ count (9102.0) -
@todo
@todo -
Scanf
:: FormatString # prune(n=matched _ count) (3102.0) -
@todo
@todo -
StringScanner
# clear -> self (3019.0) -
スキャンポインタを文字列末尾後まで進め、マッチ記録を捨てます。
...emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.scan(/\w+/) # => "test"
s.matched # => "test"
s.pos # => 4
s[0] # => "test"
s.terminate
s.matched # => nil
s[0] # => nil
s.pos # => 11
//}
StringScanner#clear は将来のバージ......ョンで削除される予定です。
代わりに StringScanner#terminate を使ってください。... -
StringScanner
# reset -> self (3019.0) -
スキャンポインタを文字列の先頭 (インデックス 0) に戻し、 マッチ記録を捨てます。
...です。
@return self を返します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.scan(/\w+/) # => "test"
s.matched # => "test"
s.pos # => 4
s[0] # => "test"
s.reset
s.matched # => nil
s[0] # => nil
s.pos # => 0
//}...