Repository URL to install this package:
|
Version:
2.2.2-1 ▾
|
U:RDoc::AnyMethod[iI" gsub:ETI"String#gsub;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"GReturns a copy of <i>str</i> with the <em>all</em> occurrences of ;TI"O<i>pattern</i> substituted for the second argument. The <i>pattern</i> is ;TI"Mtypically a <code>Regexp</code>; if given as a <code>String</code>, any ;TI"Gregular expression metacharacters it contains will be interpreted ;TI"Pliterally, e.g. <code>'\\\d'</code> will match a backlash followed by 'd', ;TI"instead of a digit.;To:RDoc::Markup::BlankLine o;
; [I"OIf <i>replacement</i> is a <code>String</code> it will be substituted for ;TI"Othe matched text. It may contain back-references to the pattern's capture ;TI"Pgroups of the form <code>\\\d</code>, where <i>d</i> is a group number, or ;TI"F<code>\\\k<n></code>, where <i>n</i> is a group name. If it is a ;TI"Gdouble-quoted string, both back-references must be preceded by an ;TI"Padditional backslash. However, within <i>replacement</i> the special match ;TI"Mvariables, such as <code>$&</code>, will not refer to the current match.;T@o;
; [I"PIf the second argument is a <code>Hash</code>, and the matched text is one ;TI"Dof its keys, the corresponding value is the replacement string.;T@o;
; [ I"NIn the block form, the current match string is passed in as a parameter, ;TI"Nand variables such as <code>$1</code>, <code>$2</code>, <code>$`</code>, ;TI"O<code>$&</code>, and <code>$'</code> will be set appropriately. The value ;TI"Jreturned by the block will be substituted for the match on each call.;T@o;
; [I"MThe result inherits any tainting in the original string or any supplied ;TI"replacement string.;T@o;
; [I"@When neither a block nor a second argument is supplied, an ;TI")<code>Enumerator</code> is returned.;T@o:RDoc::Markup::Verbatim; [
I"?"hello".gsub(/[aeiou]/, '*') #=> "h*ll*"
;TI"C"hello".gsub(/([aeiou])/, '<\1>') #=> "h<e>ll<o>"
;TI"N"hello".gsub(/./) {|s| s.ord.to_s + ' '} #=> "104 101 108 108 111 "
;TI"C"hello".gsub(/(?<foo>[aeiou])/, '{\k<foo>}') #=> "h{e}ll{o}"
;TI">'hello'.gsub(/[eo]/, 'e' => 3, 'o' => '*') #=> "h3ll*";T:@format0:
@fileI"
string.c;T:0@omit_headings_from_table_of_contents_below0I"Ãstr.gsub(pattern, replacement) -> new_str
str.gsub(pattern, hash) -> new_str
str.gsub(pattern) {|match| block } -> new_str
str.gsub(pattern) -> enumerator
;T0[ I"(*args);T@6FI"String;TcRDoc::NormalClassI"
scanf;T0