PageRenderTime 41ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/TDDBC_Yokohama2_PCUnit/Ruby/share/ri/1.9.1/system/String/gsub-i.ri

https://bitbucket.org/aetos/tddbc_yokohama2
Unknown | 0 lines | 0 code | 0 blank | 0 comment | 0 complexity | 87f64218a4d390db2818b6081e485658 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0, AGPL-3.0, 0BSD, Unlicense
  1. U:RDoc::AnyMethod[iI" gsub:EFI"String#gsub;FF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [ I"FReturns a copy of <i>str</i> with the <em>all</em> occurrences of;FI"N<i>pattern</i> substituted for the second argument. The <i>pattern</i> is;FI"Ltypically a <code>Regexp</code>; if given as a <code>String</code>, any;FI"Fregular expression metacharacters it contains will be interpreted;FI"Oliterally, e.g. <code>'\\\d'</code> will match a backlash followed by 'd',;FI"instead of a digit.;Fo:RDoc::Markup::BlankLineo;
  2. ; [ I"NIf <i>replacement</i> is a <code>String</code> it will be substituted for;FI"Nthe matched text. It may contain back-references to the pattern's capture;FI"Ogroups of the form <code>\\\d</code>, where <i>d</i> is a group number, or;FI"E<code>\\\k<n></code>, where <i>n</i> is a group name. If it is a;FI"Fdouble-quoted string, both back-references must be preceded by an;FI"Oadditional backslash. However, within <i>replacement</i> the special match;FI"Mvariables, such as <code>&$</code>, will not refer to the current match.;Fo; �o;
  3. ; [I"OIf the second argument is a <code>Hash</code>, and the matched text is one;FI"Dof its keys, the corresponding value is the replacement string.;Fo; o;
  4. ; [ I"MIn the block form, the current match string is passed in as a parameter,;FI"Mand variables such as <code>$1</code>, <code>$2</code>, <code>$`</code>,;FI"N<code>$&</code>, and <code>$'</code> will be set appropriately. The value;FI"Jreturned by the block will be substituted for the match on each call.;Fo; �o;
  5. ; [I"LThe result inherits any tainting in the original string or any supplied;FI"replacement string.;Fo; �o;
  6. ; [I"?When neither a block nor a second argument is supplied, an;FI")<code>Enumerator</code> is returned.;Fo; �o:RDoc::Markup::Verbatim; [I" ;FI">"hello".gsub(/[aeiou]/, '*') #=> "h*ll*";FI"
  7. ;FI" ;FI"B"hello".gsub(/([aeiou])/, '<\1>') #=> "h<e>ll<o>";FI"
  8. ;FI" ;FI"M"hello".gsub(/./) {|s| s.ord.to_s + ' '} #=> "104 101 108 108 111 ";FI"
  9. ;FI" ;FI"B"hello".gsub(/(?<foo>[aeiou])/, '{\k<foo>}') #=> "h{e}ll{o}";FI"
  10. ;FI" ;FI">'hello'.gsub(/[eo]/, 'e' => 3, 'o' => '*') #=> "h3ll*";FI"Ăstr.gsub(pattern, replacement) -> new_str
  11. str.gsub(pattern, hash) -> new_str
  12. str.gsub(pattern) {|match| block } -> new_str
  13. str.gsub(pattern) -> enumerator
  14. ;F0[�I"
  15. (...);F