528件ヒット
[101-200件を表示]
(0.066秒)
ライブラリ
- strscan (528)
キーワード
- << (12)
- [] (12)
-
beginning
_ of _ line? (12) - bol? (12)
- charpos (12)
- check (12)
-
check
_ until (12) - clear (12)
- concat (12)
- empty? (12)
- eos? (12)
- exist? (12)
-
get
_ byte (12) - getbyte (12)
- getch (12)
- inspect (12)
- match? (12)
- matched (12)
- matched? (12)
-
matched
_ size (12) - matchedsize (12)
- peek (12)
- peep (12)
- pointer (12)
- pointer= (12)
- pos (12)
- pos= (12)
-
post
_ match (12) -
pre
_ match (12) - reset (12)
- rest (12)
- rest? (12)
-
rest
_ size (12) - restsize (12)
-
scan
_ full (12) -
scan
_ until (12) -
search
_ full (12) - skip (12)
-
skip
_ until (12) - string (12)
- string= (12)
- terminate (12)
- unscan (12)
検索結果
先頭5件
-
StringScanner
# matched -> String | nil (9120.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 # => " "
//}... -
StringScanner
# matched? -> bool (9120.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 (9120.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
# search _ full(regexp , s , f) -> object (9114.0) -
regexp で指定された正規表現とマッチするまで文字列をスキャンします。
...search_full(regexp, true, true) は StringScanner#scan_until と同等。
* search_full(regexp, true, false) は StringScanner#skip_until と同等。
* search_full(regexp, false, true) は StringScanner#check_until と同等。
* search_full(regexp, false, false) は StringScanner#exis......scan'
s = StringScanner.new('test string')
p s.search_full(/t/, true, true) #=> "t"
p s.search_full(/str/, false, true) #=> "est str"
p s.search_full(/string/, true, true) #=> "est string"
//}
@see StringScanner#scan_until StringScanner#skip_until StringScanner#check_until StringScan... -
StringScanner
# charpos -> Integer (9108.0) -
現在のスキャンポインタのインデックスを文字単位で返します。
...キャンポインタのインデックスを文字単位で返します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new("abcädeföghi")
s.charpos # => 0
s.scan_until(/ä/) # => "abcä"
s.pos # => 5
s.charpos # => 4
//}
@see StringScanner#pos... -
StringScanner
# clear -> self (9108.0) -
スキャンポインタを文字列末尾後まで進め、マッチ記録を捨てます。
...list[例][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
# check(regexp) -> String | nil (9102.0) -
現在位置から regexp とのマッチを試みます。 マッチに成功したらマッチした部分文字列を返します。 マッチに失敗したら nil を返します。
...を進めません。
@param regexp マッチに用いる正規表現を指定します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.check(/\w+/) # => "test"
s.pos # => 0
s.matched # => "test"
s.check(/\s+/) # => nil
s.matched # => nil
//}... -
StringScanner
# check _ until(regexp) -> String | nil (9102.0) -
regexp が一致するまで文字列をスキャンします。 マッチに成功したらスキャン開始位置からマッチ部分の末尾までの部分文字列を返します。 マッチに失敗したら nil を返します。
...めません。
@param regexp マッチに用いる正規表現を指定します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.check_until(/str/) # => "test str"
s.matched # => "str"
s.pos # => 0
s.pre_match # => "test "
//}... -
StringScanner
# getch -> String | nil (9102.0) -
一文字スキャンして文字列で返します。 スキャンポインタをその後ろに進めます。 スキャンポインタが文字列の末尾を指すならnilを返します。
...。
//emlist[例][ruby]{
require 'strscan'
utf8 = "\u{308B 3073 3044}"
s = StringScanner.new(utf8.encode("UTF-8"))
p s.getch # => "る"
p s.getch # => "び"
p s.getch # => "い"
p s.getch # => nil
//}...