ライブラリ
- ビルトイン (162)
-
cgi
/ html (24) -
irb
/ cmd / help (12) -
net
/ imap (24) -
rubygems
/ specification (12) - stringio (120)
- strscan (156)
クラス
-
Gem
:: Specification (12) -
IRB
:: ExtendCommand :: Help (12) - MatchData (12)
-
Net
:: IMAP :: ContentDisposition (24) - String (141)
- StringIO (120)
- StringScanner (156)
- Symbol (9)
モジュール
-
CGI
:: HtmlExtension (24)
キーワード
- << (12)
- charpos (12)
- check (12)
-
check
_ until (12) - clear (12)
-
dsp
_ type (12) - eof (12)
- eof? (12)
- execute (12)
- form (24)
- index (12)
- insert (12)
- match (24)
- match? (18)
- param (12)
- pointer (12)
- pointer= (12)
- pos= (24)
-
post
_ match (24) - reset (12)
- rewind (12)
- rindex (12)
-
scan
_ until (12) - seek (12)
-
skip
_ until (12) - slice! (72)
- string= (12)
- tell (12)
- terminate (12)
- ungetc (12)
検索結果
先頭5件
-
StringIO
# pos -> Integer (24202.0) -
自身の現在の位置を返します。
自身の現在の位置を返します。 -
StringScanner
# pos -> Integer (21232.0) -
現在のスキャンポインタのインデックスを返します。
...デックスを返します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.pos # => 0
s.scan(/\w+/) # => "test"
s.pos # => 4
s.scan(/\w+/) # => nil
s.pos # => 4
s.scan(/\s+/) # => " "
s.pos # => 5
//}
@see StringScanner#charpos... -
StringIO
# string=(buf) (18208.0) -
自身が表す文字列を指定された buf に変更します。
...み書き両用になりますが、
buf がフリーズされている場合には読み取り専用になります。
pos と lineno は 0 にセットされます。
@param buf 自身が新たに表す文字列を指定します。
@raise TypeError buf が nil の場合に発生します。... -
StringScanner
# post _ match -> String | nil (15326.0) -
前回マッチを行った文字列のうち、マッチしたところよりも後ろの 部分文字列を返します。前回のマッチが失敗していると常に nil を 返します。
...//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.post_match # => nil
s.scan(/\w+/) # => "test"
s.post_match # => " string"
s.scan(/\w+/) # => nil
s.post_match # => nil
s.scan(/\s+/) # => " "
s.post_match # => "string"
s.scan(/\w+/) # => "string"
s.post_match # =>......""
s.scan(/\w+/) # => nil
s.post_match # => nil
//}... -
String
# match(regexp , pos = 0) -> MatchData | nil (15325.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... -
MatchData
# post _ match -> String (15302.0) -
マッチした部分より後ろの文字列を返します($'と同じ)。
...マッチした部分より後ろの文字列を返します($'と同じ)。
//emlist[例][ruby]{
/(bar)(BAZ)?/ =~ "foobarbaz"
p $~.post_match # => "baz"
//}
@see MatchData#pre_match... -
String
# insert(pos , other) -> self (15246.0) -
pos 番目の文字の直前に文字列 other を挿入します。 self[pos, 0] = other と同じ操作です。
...
pos 番目の文字の直前に文字列 other を挿入します。
self[pos, 0] = other と同じ操作です。
@param pos 文字列を挿入するインデックス
@param other 挿入する文字列
//emlist[例][ruby]{
str = "foobaz"
str.insert(3, "bar")
p str # => "foobarbaz"
//}......@see String#[]=... -
String
# match(regexp , pos = 0) {|m| . . . } -> object (15225.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
# match?(regexp , pos = 0) -> bool (15218.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?...