D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
String
/
Filename :
cdesc-String.ri
back
Copy
U:RDoc::NormalClass[iI"String:ET@I"Object;To:RDoc::Markup::Document:@parts[ o;;[ : @fileI"lib/shellwords.rb;T:0@omit_headings_from_table_of_contents_below0o;;[ ; I"pack.rb;T; 0o;;[ ; I" string.c;T; 0o;;[�o:RDoc::Markup::Paragraph;[I";A +String+ object has an arbitrary sequence of bytes, ;TI"1typically representing text or binary data. ;TI"GA +String+ object may be created using String::new or as literals.;To:RDoc::Markup::BlankLine o;;[I"JString objects differ from Symbol objects in that Symbol objects are ;TI"Adesigned to be used as identifiers, instead of text or data.;T@o;;[I"6You can create a +String+ object explicitly with:;T@o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o;;[I"GA {string literal}[rdoc-ref:syntax/literals.rdoc@String+Literals].;To;;0;[o;;[I"OA {heredoc literal}[rdoc-ref:syntax/literals.rdoc@Here+Document+Literals].;T@o;;[I"5You can convert certain objects to Strings with:;T@o; ;;;[o;;0;[o;;[I"\Method #String.;T@o;;[ I"*Some +String+ methods modify +self+. ;TI"ITypically, a method whose name ends with <tt>!</tt> modifies +self+ ;TI"and returns +self+; ;TI">often, a similarly named method (without the <tt>!</tt>) ;TI"returns a new string.;T@o;;[I"GIn general, if both bang and non-bang versions of a method exist, ;TI"?the bang method mutates and the non-bang method does not. ;TI"NHowever, a method without a bang can also mutate, such as String#replace.;T@S:RDoc::Markup::Heading: leveli: textI"Substitution Methods;T@o;;[I")These methods perform substitutions:;T@o; ;;;[ o;;0;[o;;[I"BString#sub: One substitution (or none); returns a new string.;To;;0;[o;;[I"MString#sub!: One substitution (or none); returns +self+ if any changes, ;TI"+nil+ otherwise.;To;;0;[o;;[I"CString#gsub: Zero or more substitutions; returns a new string.;To;;0;[o;;[I"NString#gsub!: Zero or more substitutions; returns +self+ if any changes, ;TI"+nil+ otherwise.;T@o;;[I"!Each of these methods takes:;T@o; ;;;[o;;0;[o;;[I"5A first argument, +pattern+ (String or Regexp), ;TI"4that specifies the substring(s) to be replaced.;T@o;;0;[o;;[I"Either of the following:;T@o; ;;;[o;;0;[o;;[I"8A second argument, +replacement+ (String or Hash), ;TI"*that determines the replacing string.;To;;0;[o;;[I"6A block that will determine the replacing string.;T@o;;[I"UThe examples in this section mostly use the String#sub and String#gsub methods; ;TI"Gthe principles illustrated apply to all four substitution methods.;T@o;;[I"<b>Argument +pattern+</b>;T@o;;[I"9Argument +pattern+ is commonly a regular expression:;T@o:RDoc::Markup::Verbatim;[I"s = 'hello' ;TI"(s.sub(/[aeiou]/, '*') # => "h*llo" ;TI")s.gsub(/[aeiou]/, '*') # => "h*ll*" ;TI"'s.gsub(/[aeiou]/, '') # => "hll" ;TI"(s.sub(/ell/, 'al') # => "halo" ;TI")s.gsub(/xyzzy/, '*') # => "hello" ;TI".'THX1138'.gsub(/\d+/, '00') # => "THX00" ;T:@format0o;;[I"@When +pattern+ is a string, all its characters are treated ;TI"?as ordinary characters (not as Regexp special characters):;T@o;;[I"0'THX1138'.gsub('\d+', '00') # => "THX1138" ;T;0o;;[I""<b>+String+ +replacement+</b>;T@o;;[I":If +replacement+ is a string, that string determines ;TI"Cthe replacing string that is substituted for the matched text.;T@o;;[I"MEach of the examples above uses a simple string as the replacing string.;T@o;;[I"R+String+ +replacement+ may contain back-references to the pattern's captures:;T@o; ;;;[o;;0;[o;;[I"G<tt>\n</tt> (_n_ is a non-negative integer) refers to <tt>$n</tt>.;To;;0;[o;;[I":<tt>\k<name></tt> refers to the named capture +name+.;T@o;;[I"See Regexp for details.;T@o;;[ I"HNote that within the string +replacement+, a character combination ;TI"=such as <tt>$&</tt> is treated as ordinary text, not as ;TI"a special match variable. ;TI"HHowever, you may refer to some special match variables using these ;TI"combinations:;T@o; ;;;[ o;;0;[o;;[I"<<tt>\&</tt> and <tt>\0</tt> correspond to <tt>$&</tt>, ;TI".which contains the complete matched text.;To;;0;[o;;[I"-<tt>\'</tt> corresponds to <tt>$'</tt>, ;TI"/which contains the string after the match.;To;;0;[o;;[I"-<tt>\`</tt> corresponds to <tt>$`</tt>, ;TI"0which contains the string before the match.;To;;0;[o;;[I".<tt>\\+</tt> corresponds to <tt>$+</tt>, ;TI"+which contains the last capture group.;T@o;;[I"See Regexp for details.;T@o;;[I"SNote that <tt>\\\\</tt> is interpreted as an escape, i.e., a single backslash.;T@o;;[I";Note also that a string literal consumes backslashes. ;TI"lSee {String Literals}[rdoc-ref:syntax/literals.rdoc@String+Literals] for details about string literals.;T@o;;[ I"HA back-reference is typically preceded by an additional backslash. ;TI"GFor example, if you want to write a back-reference <tt>\&</tt> in ;TI"J+replacement+ with a double-quoted string literal, you need to write ;TI"<tt>"..\\\\&.."</tt>.;T@o;;[ I"EIf you want to write a non-back-reference string <tt>\&</tt> in ;TI"F+replacement+, you need to first escape the backslash to prevent ;TI"Hthis method from interpreting it as a back-reference, and then you ;TI"Kneed to escape the backslashes again to prevent a string literal from ;TI".consuming them: <tt>"..\\\\\\\\&.."</tt>.;T@o;;[I"GYou may want to use the block form to avoid excessive backslashes.;T@o;;[I"<b>\Hash +replacement+</b>;T@o;;[I"UIf the argument +replacement+ is a hash, and +pattern+ matches one of its keys, ;TI"4the replacing string is the value for that key:;T@o;;[I"*h = {'foo' => 'bar', 'baz' => 'bat'} ;TI"&'food'.sub('foo', h) # => "bard" ;T;0o;;[I"+Note that a symbol key does not match:;T@o;;[I""h = {foo: 'bar', baz: 'bat'} ;TI"#'food'.sub('foo', h) # => "d" ;T;0o;;[I"<b>Block</b>;T@o;;[I"IIn the block form, the current match string is passed to the block; ;TI";the block's return value becomes the replacing string:;T@o;;[I" s = '@' ;TI"7'1234'.gsub(/\d/) { |match| s.succ! } # => "ABCD" ;T;0o;;[I"LSpecial match variables such as <tt>$1</tt>, <tt>$2</tt>, <tt>$`</tt>, ;TI"8<tt>$&</tt>, and <tt>$'</tt> are set appropriately.;T@S;;i;I"Whitespace in Strings;T@o;;[I"[In the class +String+, _whitespace_ is defined as a contiguous sequence of characters ;TI"0consisting of any mixture of the following:;T@o; ;;;[o;;0;[o;;[I"3NL (null): <tt>"\x00"</tt>, <tt>"\u0000"</tt>.;To;;0;[o;;[I"9HT (horizontal tab): <tt>"\x09"</tt>, <tt>"\t"</tt>.;To;;0;[o;;[I"4LF (line feed): <tt>"\x0a"</tt>, <tt>"\n"</tt>.;To;;0;[o;;[I"7VT (vertical tab): <tt>"\x0b"</tt>, <tt>"\v"</tt>.;To;;0;[o;;[I"4FF (form feed): <tt>"\x0c"</tt>, <tt>"\f"</tt>.;To;;0;[o;;[I":CR (carriage return): <tt>"\x0d"</tt>, <tt>"\r"</tt>.;To;;0;[o;;[I"/SP (space): <tt>"\x20"</tt>, <tt>" "</tt>.;T@o;;[I"6Whitespace is relevant for the following methods:;T@o; ;;;[o;;0;[o;;[I"1#lstrip, #lstrip!: Strip leading whitespace.;To;;0;[o;;[I"2#rstrip, #rstrip!: Strip trailing whitespace.;To;;0;[o;;[I"<#strip, #strip!: Strip leading and trailing whitespace.;T@S;;i;I"+String+ Slices;T@o;;[I"GA _slice_ of a string is a substring selected by certain criteria.;T@o;;[I",These instance methods utilize slicing:;T@o; ;;;[o;;0;[o;;[I"MString#[] (aliased as String#slice): Returns a slice copied from +self+.;To;;0;[o;;[I"8String#[]=: Mutates +self+ with the slice replaced.;To;;0;[o;;[I"XString#slice!: Mutates +self+ with the slice removed and returns the removed slice.;T@o;;[I"HEach of the above methods takes arguments that determine the slice ;TI"to be copied or replaced.;T@o;;[I"'The arguments have several forms. ;TI"*For a string +string+, the forms are:;T@o; ;;;[ o;;0;[o;;[I"<tt>string[index]</tt>;To;;0;[o;;[I"#<tt>string[start, length]</tt>;To;;0;[o;;[I"<tt>string[range]</tt>;To;;0;[o;;[I")<tt>string[regexp, capture = 0]</tt>;To;;0;[o;;[I"<tt>string[substring]</tt>;T@o;;[I""<b><tt>string[index]</tt></b>;T@o;;[I"<When a non-negative integer argument +index+ is given, ;TI"Xthe slice is the 1-character substring found in +self+ at character offset +index+:;T@o;;[ I"'bar'[0] # => "b" ;TI"'bar'[2] # => "r" ;TI"'bar'[20] # => nil ;TI"!'тест'[2] # => "с" ;TI"%'こんにちは'[4] # => "は" ;T;0o;;[I"/When a negative integer +index+ is given, ;TI"Vthe slice begins at the offset given by counting backward from the end of +self+:;T@o;;[I"'bar'[-3] # => "b" ;TI"'bar'[-1] # => "r" ;TI"'bar'[-20] # => nil ;T;0o;;[I"*<b><tt>string[start, length]</tt></b>;T@o;;[I"IWhen non-negative integer arguments +start+ and +length+ are given, ;TI"Athe slice begins at character offset +start+, if it exists, ;TI"9and continues for +length+ characters, if available:;T@o;;[I" 'foo'[0, 2] # => "fo" ;TI"&'тест'[1, 2] # => "ес" ;TI"+'こんにちは'[2, 2] # => "にち" ;TI"# Zero length. ;TI"'foo'[2, 0] # => "" ;TI"&# Length not entirely available. ;TI" 'foo'[1, 200] # => "oo" ;TI"# Start out of range. ;TI"'foo'[4, 2] # => nil ;T;0o;;[I";Special case: if +start+ equals the length of +self+, ;TI"%the slice is a new empty string:;T@o;;[I"'foo'[3, 2] # => "" ;TI"'foo'[3, 200] # => "" ;T;0o;;[I"BWhen a negative +start+ and non-negative +length+ are given, ;TI"Cthe slice begins by counting backward from the end of +self+, ;TI"9and continues for +length+ characters, if available:;T@o;;[ I" 'foo'[-2, 2] # => "oo" ;TI" 'foo'[-2, 200] # => "oo" ;TI"# Start out of range. ;TI"'foo'[-4, 2] # => nil ;T;0o;;[I":When a negative +length+ is given, there is no slice:;T@o;;[I"'foo'[1, -1] # => nil ;TI"'foo'[-2, -1] # => nil ;T;0o;;[I""<b><tt>string[range]</tt></b>;T@o;;[I"-When a Range argument +range+ is given, ;TI"Fit creates a substring of +string+ using the indices in +range+. ;TI"+The slice is then determined as above:;T@o;;[I"'foo'[0..1] # => "fo" ;TI"'foo'[0, 2] # => "fo" ;TI" ;TI"'foo'[2...2] # => "" ;TI"'foo'[2, 0] # => "" ;TI" ;TI"'foo'[1..200] # => "oo" ;TI"'foo'[1, 200] # => "oo" ;TI" ;TI"'foo'[4..5] # => nil ;TI"'foo'[4, 2] # => nil ;TI" ;TI"'foo'[-4..-3] # => nil ;TI"'foo'[-4, 2] # => nil ;TI" ;TI"'foo'[3..4] # => "" ;TI"'foo'[3, 2] # => "" ;TI" ;TI"'foo'[-2..-1] # => "oo" ;TI"'foo'[-2, 2] # => "oo" ;TI" ;TI"'foo'[-2..197] # => "oo" ;TI"'foo'[-2, 200] # => "oo" ;T;0o;;[I"0<b><tt>string[regexp, capture = 0]</tt></b>;T@o;;[I"1When the Regexp argument +regexp+ is given, ;TI"/and the +capture+ argument is <tt>0</tt>, ;TI"?the slice is the first matching substring found in +self+:;T@o;;[ I"('foo'[/o/] # => "o" ;TI"('foo'[/x/] # => nil ;TI"s = 'hello there' ;TI")s[/[aeiou](.)\1/] # => "ell" ;TI")s[/[aeiou](.)\1/, 0] # => "ell" ;T;0o;;[ I"?If the argument +capture+ is provided and not <tt>0</tt>, ;TI"9it should be either a capture group index (integer) ;TI"1or a capture group name (String or Symbol); ;TI"Ithe slice is the specified capture (see Regexp@Groups and Captures):;T@o;;[ I"s = 'hello there' ;TI"#s[/[aeiou](.)\1/, 1] # => "l" ;TI"Hs[/(?<vowel>[aeiou])(?<non_vowel>[^aeiou])/, "non_vowel"] # => "l" ;TI"Hs[/(?<vowel>[aeiou])(?<non_vowel>[^aeiou])/, :vowel] # => "e" ;T;0o;;[I"DIf an invalid capture group index is given, there is no slice. ;TI"GIf an invalid capture group name is given, +IndexError+ is raised.;T@o;;[I"&<b><tt>string[substring]</tt></b>;T@o;;[I"=When the single +String+ argument +substring+ is given, ;TI"Dit returns the substring from +self+ if found, otherwise +nil+:;T@o;;[I"'foo'['oo'] # => "oo" ;TI"'foo'['xx'] # => nil ;T;0S;;i;I"What's Here;T@o;;[I".First, what's elsewhere. \Class +String+:;T@o; ;;;[o;;0;[o;;[I"EInherits from the {Object class}[rdoc-ref:Object@What-27s+Here].;To;;0;[o;;[I"IIncludes the {Comparable module}[rdoc-ref:Comparable@What-27s+Here].;T@o;;[I"?Here, class +String+ provides methods that are useful for:;T@o; ;;;[ o;;0;[o;;[I"G{Creating a String}[rdoc-ref:String@Methods+for+Creating+a+String];To;;0;[o;;[I"V{Frozen/Unfrozen Strings}[rdoc-ref:String@Methods+for+a+Frozen-2FUnfrozen+String];To;;0;[o;;[I"5{Querying}[rdoc-ref:String@Methods+for+Querying];To;;0;[o;;[I"7{Comparing}[rdoc-ref:String@Methods+for+Comparing];To;;0;[o;;[I"I{Modifying a String}[rdoc-ref:String@Methods+for+Modifying+a+String];To;;0;[o;;[I"U{Converting to New String}[rdoc-ref:String@Methods+for+Converting+to+New+String];To;;0;[o;;[I"U{Converting to Non-String}[rdoc-ref:String@Methods+for+Converting+to+Non-String];To;;0;[o;;[I"7{Iterating}[rdoc-ref:String@Methods+for+Iterating];T@S;;i;I"$Methods for Creating a +String+;T@o; ;;;[o;;0;[o;;[I"!::new: Returns a new string.;To;;0;[o;;[I"E::try_convert: Returns a new string created from a given object.;T@S;;i;I")Methods for a Frozen/Unfrozen String;T@o; ;;;[o;;0;[o;;[I"E#+@: Returns a string that is not frozen: +self+ if not frozen; ;TI"+self.dup+ otherwise.;To;;0;[o;;[I"Y#-@ (aliased as #dedup): Returns a string that is frozen: +self+ if already frozen; ;TI"+self.freeze+ otherwise.;To;;0;[o;;[I"C#freeze: Freezes +self+ if not already frozen; returns +self+.;T@S;;i;I"Methods for Querying;T@o;;[I" _Counts_;T@o; ;;;[ o;;0;[o;;[I"M#length (aliased as #size): Returns the count of characters (not bytes).;To;;0;[o;;[I"I#empty?: Returns +true+ if +self.length+ is zero; +false+ otherwise.;To;;0;[o;;[I"+#bytesize: Returns the count of bytes.;To;;0;[o;;[I"D#count: Returns the count of substrings matching given strings.;T@o;;[I"_Substrings_;T@o; ;;;[ o;;0;[o;;[I"H#=~: Returns the index of the first substring that matches a given ;TI"@Regexp or other object; returns +nil+ if no match is found.;To;;0;[o;;[I"O#index: Returns the index of the _first_ occurrence of a given substring; ;TI"!returns +nil+ if none found.;To;;0;[o;;[I"O#rindex: Returns the index of the _last_ occurrence of a given substring; ;TI"!returns +nil+ if none found.;To;;0;[o;;[I"[#include?: Returns +true+ if the string contains a given substring; +false+ otherwise.;To;;0;[o;;[I"^#match: Returns a MatchData object if the string matches a given Regexp; +nil+ otherwise.;To;;0;[o;;[I"U#match?: Returns +true+ if the string matches a given Regexp; +false+ otherwise.;To;;0;[o;;[I"X#start_with?: Returns +true+ if the string begins with any of the given substrings.;To;;0;[o;;[I"T#end_with?: Returns +true+ if the string ends with any of the given substrings.;T@o;;[I"_Encodings_;T@o; ;;;[ o;;0;[o;;[I"X#encoding\: Returns the Encoding object that represents the encoding of the string.;To;;0;[o;;[I"i#unicode_normalized?: Returns +true+ if the string is in Unicode normalized form; +false+ otherwise.;To;;0;[o;;[I"\#valid_encoding?: Returns +true+ if the string contains only characters that are valid ;TI"for its encoding.;To;;0;[o;;[I"]#ascii_only?: Returns +true+ if the string has only ASCII characters; +false+ otherwise.;T@o;;[I"_Other_;T@o; ;;;[o;;0;[o;;[I"I#sum: Returns a basic checksum for the string: the sum of each byte.;To;;0;[o;;[I"*#hash: Returns the integer hash code.;T@S;;i;I"Methods for Comparing;T@o; ;;;[ o;;0;[o;;[I"b#== (aliased as #===): Returns +true+ if a given other string has the same content as +self+.;To;;0;[o;;[I"P#eql?: Returns +true+ if the content is the same as the given other string.;To;;0;[o;;[I"H#<=>: Returns -1, 0, or 1 as a given other string is smaller than, ;TI"%equal to, or larger than +self+.;To;;0;[o;;[I"=#casecmp: Ignoring case, returns -1, 0, or 1 as a given ;TI"Cother string is smaller than, equal to, or larger than +self+.;To;;0;[o;;[I"d#casecmp?: Returns +true+ if the string is equal to a given string after Unicode case folding; ;TI"+false+ otherwise.;T@S;;i;I"%Methods for Modifying a +String+;T@o;;[I"+Each of these methods modifies +self+.;T@o;;[I"_Insertion_;T@o; ;;;[o;;0;[o;;[I"P#insert: Returns +self+ with a given string inserted at a specified offset.;To;;0;[o;;[I"E#<<: Returns +self+ concatenated with a given string or integer.;To;;0;[o;;[I"W#append_as_bytes: Returns +self+ concatenated with strings without performing any ;TI"'encoding validation or conversion.;T@o;;[I"_Substitution_;T@o; ;;;[ o;;0;[o;;[I"g#sub!: Replaces the first substring that matches a given pattern with a given replacement string; ;TI"4returns +self+ if any changes, +nil+ otherwise.;To;;0;[o;;[I"c#gsub!: Replaces each substring that matches a given pattern with a given replacement string; ;TI"4returns +self+ if any changes, +nil+ otherwise.;To;;0;[o;;[I"U#succ! (aliased as #next!): Returns +self+ modified to become its own successor.;To;;0;[o;;[I"o#initialize_copy (aliased as #replace): Returns +self+ with its entire content replaced by a given string.;To;;0;[o;;[I"D#reverse!: Returns +self+ with its characters in reverse order.;To;;0;[o;;[I"^#setbyte: Sets the byte at a given integer offset to a given value; returns the argument.;To;;0;[o;;[I"Z#tr!: Replaces specified characters in +self+ with specified replacement characters; ;TI"4returns +self+ if any changes, +nil+ otherwise.;To;;0;[o;;[I"\#tr_s!: Replaces specified characters in +self+ with specified replacement characters, ;TI"Aremoving duplicates from the substrings that were modified; ;TI"4returns +self+ if any changes, +nil+ otherwise.;T@o;;[I" _Casing_;T@o; ;;;[ o;;0;[o;;[I"K#capitalize!: Upcases the initial character and downcases all others; ;TI"4returns +self+ if any changes, +nil+ otherwise.;To;;0;[o;;[I"Z#downcase!: Downcases all characters; returns +self+ if any changes, +nil+ otherwise.;To;;0;[o;;[I"V#upcase!: Upcases all characters; returns +self+ if any changes, +nil+ otherwise.;To;;0;[o;;[I"V#swapcase!: Upcases each downcase character and downcases each upcase character; ;TI"4returns +self+ if any changes, +nil+ otherwise.;T@o;;[I"_Encoding_;T@o; ;;;[ o;;0;[o;;[I"Z#encode!: Returns +self+ with all characters transcoded from one encoding to another.;To;;0;[o;;[I"D#unicode_normalize!: Unicode-normalizes +self+; returns +self+.;To;;0;[o;;[I"P#scrub!: Replaces each invalid byte with a given character; returns +self+.;To;;0;[o;;[I"O#force_encoding: Changes the encoding to a given encoding; returns +self+.;T@o;;[I"_Deletion_;T@o; ;;;[o;;0;[o;;[I"J#clear: Removes all content, so that +self+ is empty; returns +self+.;To;;0;[o;;[I"o#slice!, #[]=: Removes a substring determined by a given index, start/length, range, regexp, or substring.;To;;0;[o;;[I"H#squeeze!: Removes contiguous duplicate characters; returns +self+.;To;;0;[o;;[I"[#delete!: Removes characters as determined by the intersection of substring arguments.;To;;0;[o;;[I"Z#lstrip!: Removes leading whitespace; returns +self+ if any changes, +nil+ otherwise.;To;;0;[o;;[I"[#rstrip!: Removes trailing whitespace; returns +self+ if any changes, +nil+ otherwise.;To;;0;[o;;[I"f#strip!: Removes leading and trailing whitespace; returns +self+ if any changes, +nil+ otherwise.;To;;0;[o;;[I"n#chomp!: Removes the trailing record separator, if found; returns +self+ if any changes, +nil+ otherwise.;To;;0;[o;;[I"a#chop!: Removes trailing newline characters if found; otherwise removes the last character; ;TI"4returns +self+ if any changes, +nil+ otherwise.;T@S;;i;I"+Methods for Converting to New +String+;T@o;;[I"CEach of these methods returns a new +String+ based on +self+, ;TI"*often just a modified copy of +self+.;T@o;;[I"_Extension_;T@o; ;;;[o;;0;[o;;[I"@#*: Returns the concatenation of multiple copies of +self+.;To;;0;[o;;[I"F#+: Returns the concatenation of +self+ and a given other string.;To;;0;[o;;[I"G#center: Returns a copy of +self+ centered between pad substrings.;To;;0;[o;;[I"K#concat: Returns the concatenation of +self+ with given other strings.;To;;0;[o;;[I"M#prepend: Returns the concatenation of a given other string with +self+.;To;;0;[o;;[I"`#ljust: Returns a copy of +self+ of a given length, right-padded with a given other string.;To;;0;[o;;[I"_#rjust: Returns a copy of +self+ of a given length, left-padded with a given other string.;T@o;;[I"_Encoding_;T@o; ;;;[ o;;0;[o;;[I";#b: Returns a copy of +self+ with ASCII-8BIT encoding.;To;;0;[o;;[I"]#scrub: Returns a copy of +self+ with each invalid byte replaced with a given character.;To;;0;[o;;[I"Y#unicode_normalize: Returns a copy of +self+ with each character Unicode-normalized.;To;;0;[o;;[I"c#encode: Returns a copy of +self+ with all characters transcoded from one encoding to another.;T@o;;[I"_Substitution_;T@o; ;;;[o;;0;[o;;[I"`#dump: Returns a copy of +self+ with all non-printing characters replaced by \xHH notation ;TI"(and all special characters escaped.;To;;0;[o;;[I"n#undump: Returns a copy of +self+ with all <tt>\xNN</tt> notations replaced by <tt>\uNNNN</tt> notations ;TI"*and all escaped characters unescaped.;To;;0;[o;;[I"V#sub: Returns a copy of +self+ with the first substring matching a given pattern ;TI".replaced with a given replacement string.;To;;0;[o;;[I"V#gsub: Returns a copy of +self+ with each substring that matches a given pattern ;TI".replaced with a given replacement string.;To;;0;[o;;[I"R#succ (aliased as #next): Returns the string that is the successor to +self+.;To;;0;[o;;[I"M#reverse: Returns a copy of +self+ with its characters in reverse order.;To;;0;[o;;[I"l#tr: Returns a copy of +self+ with specified characters replaced with specified replacement characters.;To;;0;[o;;[I"M#tr_s: Returns a copy of +self+ with specified characters replaced with ;TI"'specified replacement characters, ;TI"@removing duplicates from the substrings that were modified.;To;;0;[o;;[I"Q#%: Returns the string resulting from formatting a given object into +self+.;T@o;;[I" _Casing_;T@o; ;;;[ o;;0;[o;;[I"L#capitalize: Returns a copy of +self+ with the first character upcased ;TI"(and all other characters downcased.;To;;0;[o;;[I"G#downcase: Returns a copy of +self+ with all characters downcased.;To;;0;[o;;[I"C#upcase: Returns a copy of +self+ with all characters upcased.;To;;0;[o;;[I"N#swapcase: Returns a copy of +self+ with all upcase characters downcased ;TI")and all downcase characters upcased.;T@o;;[I"_Deletion_;T@o; ;;;[o;;0;[o;;[I"?#delete: Returns a copy of +self+ with characters removed.;To;;0;[o;;[I"J#delete_prefix: Returns a copy of +self+ with a given prefix removed.;To;;0;[o;;[I"J#delete_suffix: Returns a copy of +self+ with a given suffix removed.;To;;0;[o;;[I"G#lstrip: Returns a copy of +self+ with leading whitespace removed.;To;;0;[o;;[I"H#rstrip: Returns a copy of +self+ with trailing whitespace removed.;To;;0;[o;;[I"S#strip: Returns a copy of +self+ with leading and trailing whitespace removed.;To;;0;[o;;[I"Y#chomp: Returns a copy of +self+ with a trailing record separator removed, if found.;To;;0;[o;;[I"d#chop: Returns a copy of +self+ with trailing newline characters or the last character removed.;To;;0;[o;;[I"U#squeeze: Returns a copy of +self+ with contiguous duplicate characters removed.;To;;0;[o;;[I"v#[] (aliased as #slice): Returns a substring determined by a given index, start/length, range, regexp, or string.;To;;0;[o;;[I"Y#byteslice: Returns a substring determined by a given index, start/length, or range.;To;;0;[o;;[I"'#chr: Returns the first character.;T@o;;[I"_Duplication_;T@o; ;;;[o;;0;[o;;[I"m#to_s (aliased as #to_str): If +self+ is a subclass of +String+, returns +self+ copied into a +String+; ;TI"otherwise, returns +self+.;T@S;;i;I"+Methods for Converting to Non-+String+;T@o;;[I"MEach of these methods converts the contents of +self+ to a non-+String+.;T@o;;[I"-<em>Characters, Bytes, and Clusters</em>;T@o; ;;;[ o;;0;[o;;[I"5#bytes: Returns an array of the bytes in +self+.;To;;0;[o;;[I":#chars: Returns an array of the characters in +self+.;To;;0;[o;;[I"E#codepoints: Returns an array of the integer ordinals in +self+.;To;;0;[o;;[I"E#getbyte: Returns the integer byte at the given index in +self+.;To;;0;[o;;[I"M#grapheme_clusters: Returns an array of the grapheme clusters in +self+.;T@o;;[I"_Splitting_;T@o; ;;;[ o;;0;[o;;[I"`#lines: Returns an array of the lines in +self+, as determined by a given record separator.;To;;0;[o;;[I"Z#partition: Returns a 3-element array determined by the first substring that matches ;TI"!a given substring or regexp.;To;;0;[o;;[I"Z#rpartition: Returns a 3-element array determined by the last substring that matches ;TI"!a given substring or regexp.;To;;0;[o;;[I"c#split: Returns an array of substrings determined by a given delimiter -- regexp or string -- ;TI"Cor, if a block is given, passes those substrings to the block.;T@o;;[I"_Matching_;T@o; ;;;[o;;0;[o;;[I"R#scan: Returns an array of substrings matching a given regexp or string, or, ;TI"Fif a block is given, passes each matching substring to the block.;To;;0;[o;;[I"_#unpack: Returns an array of substrings extracted from +self+ according to a given format.;To;;0;[o;;[I"]#unpack1: Returns the first substring extracted from +self+ according to a given format.;T@o;;[I"_Numerics_;T@o; ;;;[ o;;0;[o;;[I"b#hex: Returns the integer value of the leading characters, interpreted as hexadecimal digits.;To;;0;[o;;[I"\#oct: Returns the integer value of the leading characters, interpreted as octal digits.;To;;0;[o;;[I"H#ord: Returns the integer ordinal of the first character in +self+.;To;;0;[o;;[I"W#to_i: Returns the integer value of leading characters, interpreted as an integer.;To;;0;[o;;[I"k#to_f: Returns the floating-point value of leading characters, interpreted as a floating-point number.;T@o;;[I"!<em>Strings and Symbols</em>;T@o; ;;;[o;;0;[o;;[I"d#inspect: Returns a copy of +self+, enclosed in double quotes, with special characters escaped.;To;;0;[o;;[I"N#intern (aliased as #to_sym): Returns the symbol corresponding to +self+.;T@S;;i;I"Methods for Iterating;T@o; ;;;[o;;0;[o;;[I"K#each_byte: Calls the given block with each successive byte in +self+.;To;;0;[o;;[I"P#each_char: Calls the given block with each successive character in +self+.;To;;0;[o;;[I"]#each_codepoint: Calls the given block with each successive integer codepoint in +self+.;To;;0;[o;;[I"c#each_grapheme_cluster: Calls the given block with each successive grapheme cluster in +self+.;To;;0;[o;;[I"L#each_line: Calls the given block with each successive line in +self+, ;TI"/as determined by a given record separator.;To;;0;[o;;[I"_#upto: Calls the given block with each string value returned by successive calls to #succ.;T; I"string.rb;T; 0; 0; 0[ [ [[I"Comparable;To;;[ ; @; 0I" string.c;T[[I" class;T[[:public[[I"new;T@P[I"try_convert;T@P[:protected[ [:private[ [I" instance;T[[;[�[I"%;T@P[I"*;T@P[I"+;T@P[I"+@;T@P[I"-@;T@P[I"<<;T@P[I"<=>;T@P[I"==;T@P[I"===;T@P[I"=~;T@P[I"[];T@P[I"[]=;T@P[I"append_as_bytes;T@P[I"ascii_only?;T@P[I"b;T@P[I"byteindex;T@P[I"byterindex;T@P[I" bytes;T@P[I" bytesize;T@P[I"byteslice;T@P[I"bytesplice;T@P[I"capitalize;T@P[I"capitalize!;T@P[I"casecmp;T@P[I" casecmp?;T@P[I"center;T@P[I" chars;T@P[I" chomp;T@P[I"chomp!;T@P[I" chop;T@P[I" chop!;T@P[I"chr;T@P[I" clear;T@P[I"codepoints;T@P[I"concat;T@P[I" count;T@P[I" crypt;T@P[I" dedup;T@P[I"delete;T@P[I"delete!;T@P[I"delete_prefix;T@P[I"delete_prefix!;T@P[I"delete_suffix;T@P[I"delete_suffix!;T@P[I" downcase;T@P[I"downcase!;T@P[I" dump;T@P[I"each_byte;T@P[I"each_char;T@P[I"each_codepoint;T@P[I"each_grapheme_cluster;T@P[I"each_line;T@P[I"empty?;T@P[I"encode;TI"transcode.c;T[I"encode!;T@�[I" encoding;T@P[I"end_with?;T@P[I" eql?;T@P[I"force_encoding;T@P[I"getbyte;T@P[I"grapheme_clusters;T@P[I" gsub;T@P[I" gsub!;T@P[I" hash;T@P[I"hex;T@P[I" include?;T@P[I" index;T@P[I"initialize_copy;T@P[I"insert;T@P[I"inspect;T@P[I"intern;T@P[I"length;T@P[I" lines;T@P[I" ljust;T@P[I"lstrip;T@P[I"lstrip!;T@P[I" match;T@P[I"match?;T@P[I" next;T@P[I" next!;T@P[I"oct;T@P[I"ord;T@P[I"partition;T@P[I"prepend;T@P[I"replace;T@P[I"reverse;T@P[I" reverse!;T@P[I"rindex;T@P[I" rjust;T@P[I"rpartition;T@P[I"rstrip;T@P[I"rstrip!;T@P[I" scan;T@P[I" scrub;T@P[I"scrub!;T@P[I"setbyte;T@P[I"shellescape;TI"lib/shellwords.rb;T[I"shellsplit;T@'[I" size;T@P[I" slice;T@P[I"slice!;T@P[I" split;T@P[I"squeeze;T@P[I" squeeze!;T@P[I"start_with?;T@P[I" strip;T@P[I"strip!;T@P[I"sub;T@P[I" sub!;T@P[I" succ;T@P[I" succ!;T@P[I"sum;T@P[I" swapcase;T@P[I"swapcase!;T@P[I" to_c;TI"complex.c;T[I" to_f;T@P[I" to_i;T@P[I" to_r;TI"rational.c;T[I" to_s;T@P[I"to_str;T@P[I"to_sym;T@P[I"tr;T@P[I"tr!;T@P[I" tr_s;T@P[I" tr_s!;T@P[I"undump;T@P[I"unicode_normalize;T@P[I"unicode_normalize!;T@P[I"unicode_normalized?;T@P[I"unpack;TI"pack.rb;T[I"unpack1;T@l[I"upcase;T@P[I"upcase!;T@P[I" upto;T@P[I"valid_encoding?;T@P[;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ; 0; 0[I"complex.c;TI"lib/mkmf.rb;TI"lib/pp.rb;T@ @I"rational.c;T@@HI"transcode.c;T@�cRDoc::TopLevel