D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
String
/
Filename :
byteslice-i.ri
back
Copy
U:RDoc::AnyMethod[iI"byteslice:ETI"String#byteslice;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"TReturns a substring of +self+, or +nil+ if the substring cannot be constructed.;To:RDoc::Markup::BlankLine o; ; [ I"8With integer arguments +index+ and +length+ given, ;TI":returns the substring beginning at the given +index+ ;TI"*of the given +length+ (if possible), ;TI"Ior +nil+ if +length+ is negative or +index+ falls outside of +self+:;T@o:RDoc::Markup::Verbatim; [I"(s = '0123456789' # => "0123456789" ;TI"s.byteslice(2) # => "2" ;TI"s.byteslice(200) # => nil ;TI"#s.byteslice(4, 3) # => "456" ;TI"&s.byteslice(4, 30) # => "456789" ;TI"!s.byteslice(4, -1) # => nil ;TI"!s.byteslice(40, 2) # => nil ;T:@format0o; ; [I"CIn either case above, counts backwards from the end of +self+ ;TI"if +index+ is negative:;T@o;; [I"*s = '0123456789' # => "0123456789" ;TI"!s.byteslice(-4) # => "6" ;TI"#s.byteslice(-4, 3) # => "678" ;T; 0o; ; [I"0With Range argument +range+ given, returns ;TI"1<tt>byteslice(range.begin, range.size)</tt>:;T@o;; [ I"+s = '0123456789' # => "0123456789" ;TI"$s.byteslice(4..6) # => "456" ;TI"$s.byteslice(-6..-4) # => "456" ;TI"7s.byteslice(5..2) # => "" # range.size is zero. ;TI""s.byteslice(40..42) # => nil ;T; 0o; ; [I"EIn all cases, a returned string has the same encoding as +self+:;T@o;; [I"4s.encoding # => #<Encoding:UTF-8> ;TI"3s.byteslice(4).encoding # => #<Encoding:UTF-8>;T; 0: @fileI" string.c;T:0@omit_headings_from_table_of_contents_below0I"abyteslice(index, length = 1) -> string or nil byteslice(range) -> string or nil ;T0[ I"(*args);T@9FI"String;TcRDoc::NormalClass00