るりまサーチ

最速Rubyリファレンスマニュアル検索!
510件ヒット [1-100件を表示] (0.126秒)
トップページ > クエリ:t[x] > クエリ:string[x] > クエリ:pos[x] > 種類:インスタンスメソッド[x]

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. t61string new
  4. matrix t
  5. fiddle type_size_t

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

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?...
<< 1 2 3 ... > >>