D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
String
/
Filename :
index-i.ri
back
Copy
U:RDoc::AnyMethod[iI" index:ETI"String#index;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"JReturns the integer index of the first match for the given argument, ;TI"or +nil+ if none found; ;TI"Vthe search of +self+ is forward, and begins at position +offset+ (in characters).;To:RDoc::Markup::BlankLine o; ; [I"'With string argument +substring+, ;TI"Areturns the index of the first matching substring in +self+:;T@o:RDoc::Markup::Verbatim; [I"%'foo'.index('f') # => 0 ;TI"%'foo'.index('o') # => 1 ;TI"%'foo'.index('oo') # => 1 ;TI"''foo'.index('ooo') # => nil ;TI"*'тест'.index('с') # => 2 ;TI"-'こんにちは'.index('ち') # => 3 ;T:@format0o; ; [I"SWith Regexp argument +regexp+, returns the index of the first match in +self+:;T@o;; [I"'foo'.index(/o./) # => 1 ;TI"'foo'.index(/.o/) # => 0 ;T; 0o; ; [I"LWith positive integer +offset+, begins the search at position +offset+:;T@o;; [ I"''foo'.index('o', 1) # => 1 ;TI"''foo'.index('o', 2) # => 2 ;TI")'foo'.index('o', 3) # => nil ;TI",'тест'.index('с', 1) # => 2 ;TI"/'こんにちは'.index('ち', 2) # => 3 ;T; 0o; ; [I"VWith negative integer +offset+, selects the search position by counting backward ;TI"from the end of +self+:;T@o;; [I""'foo'.index('o', -1) # => 2 ;TI""'foo'.index('o', -2) # => 1 ;TI""'foo'.index('o', -3) # => 1 ;TI"$'foo'.index('o', -4) # => nil ;TI""'foo'.index(/o./, -2) # => 1 ;TI""'foo'.index(/.o/, -2) # => 1 ;T; 0o; ; [I"Related: String#rindex.;T: @fileI" string.c;T:0@omit_headings_from_table_of_contents_below0I"`index(substring, offset = 0) -> integer or nil index(regexp, offset = 0) -> integer or nil ;T0[ I"(p1, p2 = v2);T@=FI"String;TcRDoc::NormalClass00