D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
String
/
Filename :
byteindex-i.ri
back
Copy
U:RDoc::AnyMethod[iI"byteindex:ETI"String#byteindex;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"\Returns the Integer byte-based index of the first occurrence of the given +substring+, ;TI"or +nil+ if none found:;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [ I"!'foo'.byteindex('f') # => 0 ;TI"!'foo'.byteindex('o') # => 1 ;TI""'foo'.byteindex('oo') # => 1 ;TI"%'foo'.byteindex('ooo') # => nil ;T:@format0o; ; [I"\Returns the Integer byte-based index of the first match for the given Regexp +regexp+, ;TI"or +nil+ if none found:;T@o;; [ I"!'foo'.byteindex(/f/) # => 0 ;TI"!'foo'.byteindex(/o/) # => 1 ;TI""'foo'.byteindex(/oo/) # => 1 ;TI"%'foo'.byteindex(/ooo/) # => nil ;T; 0o; ; [I"SInteger argument +offset+, if given, specifies the byte-based position in the ;TI" string to begin the search:;T@o;; [I"$'foo'.byteindex('o', 1) # => 1 ;TI"$'foo'.byteindex('o', 2) # => 2 ;TI"&'foo'.byteindex('o', 3) # => nil ;T; 0o; ; [I"EIf +offset+ is negative, counts backward from the end of +self+:;T@o;; [ I"%'foo'.byteindex('o', -1) # => 2 ;TI"%'foo'.byteindex('o', -2) # => 1 ;TI"%'foo'.byteindex('o', -3) # => 1 ;TI"''foo'.byteindex('o', -4) # => nil ;T; 0o; ; [I"RIf +offset+ does not land on character (codepoint) boundary, +IndexError+ is ;TI"raised.;T@o; ; [I".Related: String#index, String#byterindex.;T: @fileI" string.c;T:0@omit_headings_from_table_of_contents_below0I"hbyteindex(substring, offset = 0) -> integer or nil byteindex(regexp, offset = 0) -> integer or nil ;T0[ I"(p1, p2 = v2);T@9FI"String;TcRDoc::NormalClass00