Hacked By AnonymousFox

Current Path : /proc/thread-self/root/proc/self/root/opt/alt/ruby18/share/ri/1.8/system/String/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/opt/alt/ruby18/share/ri/1.8/system/String/sub-i.yaml

--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: Returns a copy of <em>str</em> with the <em>first</em> occurrence of <em>pattern</em> replaced with either <em>replacement</em> or the value of the block. The <em>pattern</em> will typically be a <tt>Regexp</tt>; if it is a <tt>String</tt> then no regular expression metacharacters will be interpreted (that is <tt>/\d/</tt> will match a digit, but <tt>'\d'</tt> will match a backslash followed by a 'd').
- !ruby/struct:SM::Flow::P 
  body: If the method call specifies <em>replacement</em>, special variables such as <tt>$&amp;</tt> will not be useful, as substitution into the string occurs before the pattern match starts. However, the sequences <tt>\1</tt>, <tt>\2</tt>, etc., may be used.
- !ruby/struct:SM::Flow::P 
  body: In the block form, the current match string is passed in as a parameter, and variables such as <tt>$1</tt>, <tt>$2</tt>, <tt>$`</tt>, <tt>$&amp;</tt>, and <tt>$'</tt> will be set appropriately. The value returned by the block will be substituted for the match on each call.
- !ruby/struct:SM::Flow::P 
  body: The result inherits any tainting in the original string or any supplied replacement string.
- !ruby/struct:SM::Flow::VERB 
  body: "   &quot;hello&quot;.sub(/[aeiou]/, '*')               #=&gt; &quot;h*llo&quot;\n   &quot;hello&quot;.sub(/([aeiou])/, '&lt;\\1&gt;')          #=&gt; &quot;h&lt;e&gt;llo&quot;\n   &quot;hello&quot;.sub(/./) {|s| s[0].to_s + ' ' }   #=&gt; &quot;104 ello&quot;\n"
full_name: String#sub
is_singleton: false
name: sub
params: |
  str.sub(pattern, replacement)         => new_str
  str.sub(pattern) {|match| block }     => new_str

visibility: public

Hacked By AnonymousFox1.0, Coded By AnonymousFox