るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.021秒)
トップページ > クエリ:index[x] > ライブラリ:strscan[x]

別のキーワード

  1. matrix index
  2. matrix find_index
  3. _builtin find_index
  4. _builtin index
  5. matrix each_with_index

クラス

キーワード

検索結果

StringScanner#pointer=(n) (8.0)

スキャンポインタのインデックスを n にセットします。

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

s = StringScanner.new('test string')
p s.scan(/\w+/) # => "test"
p s.pos = 1 # => 1
p s.scan(/\w+/) # => "est"
p s.pos = 7 # => 7
p s.scan(/\w+/) # => "ring"

begin
s.pos = 20
rescue RangeError => err
puts err #=> index out of range
end
p s.pos = -...

StringScanner#pos=(n) (8.0)

スキャンポインタのインデックスを n にセットします。

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

s = StringScanner.new('test string')
p s.scan(/\w+/) # => "test"
p s.pos = 1 # => 1
p s.scan(/\w+/) # => "est"
p s.pos = 7 # => 7
p s.scan(/\w+/) # => "ring"

begin
s.pos = 20
rescue RangeError => err
puts err #=> index out of range
end
p s.pos = -...