1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

string.c: [DOC] remove unnecessary markups [ci skip]

* string.c: remove <code> markups, which are not only unnecessary
  but also prevented cross-references.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2019-03-20 01:31:44 +00:00
parent a265141c84
commit 8b49e5b47d

195
string.c
View file

@ -1883,7 +1883,7 @@ rb_str_empty(VALUE str)
* call-seq: * call-seq:
* str + other_str -> new_str * str + other_str -> new_str
* *
* Concatenation---Returns a new <code>String</code> containing * Concatenation---Returns a new String containing
* <i>other_str</i> concatenated to <i>str</i>. * <i>other_str</i> concatenated to <i>str</i>.
* *
* "Hello from " + self.to_s #=> "Hello from main" * "Hello from " + self.to_s #=> "Hello from main"
@ -1993,11 +1993,11 @@ rb_str_times(VALUE str, VALUE times)
* call-seq: * call-seq:
* str % arg -> new_str * str % arg -> new_str
* *
* Format---Uses <i>str</i> as a format specification, and returns the result * Format---Uses <i>str</i> as a format specification, and returns
* of applying it to <i>arg</i>. If the format specification contains more than * the result of applying it to <i>arg</i>. If the format
* one substitution, then <i>arg</i> must be an <code>Array</code> or <code>Hash</code> * specification contains more than one substitution, then <i>arg</i>
* containing the values to be substituted. See <code>Kernel::sprintf</code> for * must be an Array or Hash containing the values to be
* details of the format string. * substituted. See Kernel::sprintf for details of the format string.
* *
* "%05d" % 123 #=> "00123" * "%05d" % 123 #=> "00123"
* "%-5s: %016x" % [ "ID", self.object_id ] #=> "ID : 00002b054ec93168" * "%-5s: %016x" % [ "ID", self.object_id ] #=> "ID : 00002b054ec93168"
@ -2980,8 +2980,8 @@ rb_str_concat_literals(size_t num, const VALUE *strary)
* str.concat(obj1, obj2, ...) -> str * str.concat(obj1, obj2, ...) -> str
* *
* Concatenates the given object(s) to <i>str</i>. If an object is an * Concatenates the given object(s) to <i>str</i>. If an object is an
* <code>Integer</code>, it is considered a codepoint and converted * Integer, it is considered a codepoint and converted to a character
* to a character before concatenation. * before concatenation.
* *
* +concat+ can take multiple arguments, and all the arguments are * +concat+ can take multiple arguments, and all the arguments are
* concatenated in order. * concatenated in order.
@ -3022,8 +3022,8 @@ rb_str_concat_multi(int argc, VALUE *argv, VALUE str)
* str << integer -> str * str << integer -> str
* *
* Appends the given object to <i>str</i>. If the object is an * Appends the given object to <i>str</i>. If the object is an
* <code>Integer</code>, it is considered a codepoint and converted * Integer, it is considered a codepoint and converted to a character
* to a character before being appended. * before being appended.
* *
* a = "hello " * a = "hello "
* a << "world" #=> "hello world" * a << "world" #=> "hello world"
@ -3321,7 +3321,7 @@ static VALUE str_casecmp_p(VALUE str1, VALUE str2);
* call-seq: * call-seq:
* str.casecmp(other_str) -> -1, 0, +1, or nil * str.casecmp(other_str) -> -1, 0, +1, or nil
* *
* Case-insensitive version of <code>String#<=></code>. * Case-insensitive version of String#<=>.
* Currently, case-insensitivity only works on characters A-Z/a-z, * Currently, case-insensitivity only works on characters A-Z/a-z,
* not all of Unicode. This is different from String#casecmp?. * not all of Unicode. This is different from String#casecmp?.
* *
@ -3756,11 +3756,11 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
* call-seq: * call-seq:
* str =~ obj -> integer or nil * str =~ obj -> integer or nil
* *
* Match---If <i>obj</i> is a <code>Regexp</code>, use it as a pattern to match * Match---If <i>obj</i> is a Regexp, use it as a pattern to match
* against <i>str</i>,and returns the position the match starts, or * against <i>str</i>,and returns the position the match starts, or
* <code>nil</code> if there is no match. Otherwise, invokes * <code>nil</code> if there is no match. Otherwise, invokes
* <i>obj.=~</i>, passing <i>str</i> as an argument. The default * <i>obj.=~</i>, passing <i>str</i> as an argument. The default
* <code>=~</code> in <code>Object</code> returns <code>nil</code>. * <code>=~</code> in Object returns <code>nil</code>.
* *
* Note: <code>str =~ regexp</code> is not the same as * Note: <code>str =~ regexp</code> is not the same as
* <code>regexp =~ str</code>. Strings captured from named capture groups * <code>regexp =~ str</code>. Strings captured from named capture groups
@ -3796,7 +3796,7 @@ static VALUE get_pat(VALUE);
* str.match(pattern) -> matchdata or nil * str.match(pattern) -> matchdata or nil
* str.match(pattern, pos) -> matchdata or nil * str.match(pattern, pos) -> matchdata or nil
* *
* Converts <i>pattern</i> to a <code>Regexp</code> (if it isn't already one), * Converts <i>pattern</i> to a Regexp (if it isn't already one),
* then invokes its <code>match</code> method on <i>str</i>. If the second * then invokes its <code>match</code> method on <i>str</i>. If the second
* parameter is present, it specifies the position in the string to begin the * parameter is present, it specifies the position in the string to begin the
* search. * search.
@ -4176,8 +4176,7 @@ str_succ(VALUE str)
* str.succ! -> str * str.succ! -> str
* str.next! -> str * str.next! -> str
* *
* Equivalent to <code>String#succ</code>, but modifies the receiver in * Equivalent to String#succ, but modifies the receiver in place.
* place.
*/ */
static VALUE static VALUE
@ -4211,10 +4210,11 @@ str_upto_i(VALUE str, VALUE arg)
* str.upto(other_str, exclusive=false) -> an_enumerator * str.upto(other_str, exclusive=false) -> an_enumerator
* *
* Iterates through successive values, starting at <i>str</i> and * Iterates through successive values, starting at <i>str</i> and
* ending at <i>other_str</i> inclusive, passing each value in turn to * ending at <i>other_str</i> inclusive, passing each value in turn
* the block. The <code>String#succ</code> method is used to generate * to the block. The String#succ method is used to generate each
* each value. If optional second argument exclusive is omitted or is false, * value. If optional second argument exclusive is omitted or is
* the last value will be included; otherwise it will be excluded. * false, the last value will be included; otherwise it will be
* excluded.
* *
* If no block is given, an enumerator is returned instead. * If no block is given, an enumerator is returned instead.
* *
@ -4766,19 +4766,18 @@ rb_str_aset(VALUE str, VALUE indx, VALUE val)
* str[regexp, name] = new_str * str[regexp, name] = new_str
* str[other_str] = new_str * str[other_str] = new_str
* *
* Element Assignment---Replaces some or all of the content of <i>str</i>. The * Element Assignment---Replaces some or all of the content of
* portion of the string affected is determined using the same criteria as * <i>str</i>. The portion of the string affected is determined using
* <code>String#[]</code>. If the replacement string is not the same length as * the same criteria as String#[]. If the replacement string is not
* the text it is replacing, the string will be adjusted accordingly. If the * the same length as the text it is replacing, the string will be
* regular expression or string is used as the index doesn't match a position * adjusted accordingly. If the regular expression or string is used
* in the string, <code>IndexError</code> is raised. If the regular expression * as the index doesn't match a position in the string, IndexError is
* form is used, the optional second <code>Integer</code> allows you to specify * raised. If the regular expression form is used, the optional
* which portion of the match to replace (effectively using the * second Integer allows you to specify which portion of the match to
* <code>MatchData</code> indexing rules. The forms that take an * replace (effectively using the MatchData indexing rules. The forms
* <code>Integer</code> will raise an <code>IndexError</code> if the value is * that take an Integer will raise an IndexError if the value is out
* out of range; the <code>Range</code> form will raise a * of range; the Range form will raise a RangeError, and the Regexp
* <code>RangeError</code>, and the <code>Regexp</code> and <code>String</code> * and String will raise an IndexError on negative match.
* will raise an <code>IndexError</code> on negative match.
*/ */
static VALUE static VALUE
@ -5256,9 +5255,10 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
* str.gsub!(pattern) {|match| block } -> str or nil * str.gsub!(pattern) {|match| block } -> str or nil
* str.gsub!(pattern) -> an_enumerator * str.gsub!(pattern) -> an_enumerator
* *
* Performs the substitutions of <code>String#gsub</code> in place, returning * Performs the substitutions of String#gsub in place, returning
* <i>str</i>, or <code>nil</code> if no substitutions were performed. * <i>str</i>, or <code>nil</code> if no substitutions were
* If no block and no <i>replacement</i> is given, an enumerator is returned instead. * performed. If no block and no <i>replacement</i> is given, an
* enumerator is returned instead.
*/ */
static VALUE static VALUE
@ -5278,12 +5278,12 @@ rb_str_gsub_bang(int argc, VALUE *argv, VALUE str)
* *
* Returns a copy of <i>str</i> with <em>all</em> occurrences of * Returns a copy of <i>str</i> with <em>all</em> occurrences of
* <i>pattern</i> substituted for the second argument. The <i>pattern</i> is * <i>pattern</i> substituted for the second argument. The <i>pattern</i> is
* typically a <code>Regexp</code>; if given as a <code>String</code>, any * typically a Regexp; if given as a String, any
* regular expression metacharacters it contains will be interpreted * regular expression metacharacters it contains will be interpreted
* literally, e.g. <code>'\\\d'</code> will match a backslash followed by 'd', * literally, e.g. <code>'\\\d'</code> will match a backslash followed by 'd',
* instead of a digit. * instead of a digit.
* *
* If <i>replacement</i> is a <code>String</code> it will be substituted for * If <i>replacement</i> is a String it will be substituted for
* the matched text. It may contain back-references to the pattern's capture * the matched text. It may contain back-references to the pattern's capture
* groups of the form <code>\\\d</code>, where <i>d</i> is a group number, or * groups of the form <code>\\\d</code>, where <i>d</i> is a group number, or
* <code>\\\k<n></code>, where <i>n</i> is a group name. If it is a * <code>\\\k<n></code>, where <i>n</i> is a group name. If it is a
@ -5291,7 +5291,7 @@ rb_str_gsub_bang(int argc, VALUE *argv, VALUE str)
* additional backslash. However, within <i>replacement</i> the special match * additional backslash. However, within <i>replacement</i> the special match
* variables, such as <code>$&</code>, will not refer to the current match. * variables, such as <code>$&</code>, will not refer to the current match.
* *
* If the second argument is a <code>Hash</code>, and the matched text is one * If the second argument is a Hash, and the matched text is one
* of its keys, the corresponding value is the replacement string. * of its keys, the corresponding value is the replacement string.
* *
* In the block form, the current match string is passed in as a parameter, * In the block form, the current match string is passed in as a parameter,
@ -5303,7 +5303,7 @@ rb_str_gsub_bang(int argc, VALUE *argv, VALUE str)
* replacement string. * replacement string.
* *
* When neither a block nor a second argument is supplied, an * When neither a block nor a second argument is supplied, an
* <code>Enumerator</code> is returned. * Enumerator is returned.
* *
* "hello".gsub(/[aeiou]/, '*') #=> "h*ll*" * "hello".gsub(/[aeiou]/, '*') #=> "h*ll*"
* "hello".gsub(/([aeiou])/, '<\1>') #=> "h<e>ll<o>" * "hello".gsub(/([aeiou])/, '<\1>') #=> "h<e>ll<o>"
@ -5549,10 +5549,10 @@ str_byte_aref(VALUE str, VALUE indx)
* str.byteslice(integer, integer) -> new_str or nil * str.byteslice(integer, integer) -> new_str or nil
* str.byteslice(range) -> new_str or nil * str.byteslice(range) -> new_str or nil
* *
* Byte Reference---If passed a single <code>Integer</code>, returns a * Byte Reference---If passed a single Integer, returns a
* substring of one byte at that position. If passed two <code>Integer</code> * substring of one byte at that position. If passed two Integer
* objects, returns a substring starting at the offset given by the first, and * objects, returns a substring starting at the offset given by the first, and
* a length given by the second. If given a <code>Range</code>, a substring containing * a length given by the second. If given a Range, a substring containing
* bytes at offsets given by the range is returned. In all three cases, if * bytes at offsets given by the range is returned. In all three cases, if
* an offset is negative, it is counted from the end of <i>str</i>. Returns * an offset is negative, it is counted from the end of <i>str</i>. Returns
* <code>nil</code> if the initial offset falls outside the string, the length * <code>nil</code> if the initial offset falls outside the string, the length
@ -6797,10 +6797,11 @@ rb_str_capitalize(int argc, VALUE *argv, VALUE str)
* str.swapcase! -> str or nil * str.swapcase! -> str or nil
* str.swapcase!([options]) -> str or nil * str.swapcase!([options]) -> str or nil
* *
* Equivalent to <code>String#swapcase</code>, but modifies the receiver in * Equivalent to String#swapcase, but modifies the receiver in place,
* place, returning <i>str</i>, or <code>nil</code> if no changes were made. * returning <i>str</i>, or <code>nil</code> if no changes were made.
* *
* See String#downcase for meaning of +options+ and use with different encodings. * See String#downcase for meaning of +options+ and use with
* different encodings.
*/ */
static VALUE static VALUE
@ -7161,8 +7162,8 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
* str.tr!(from_str, to_str) -> str or nil * str.tr!(from_str, to_str) -> str or nil
* *
* Translates <i>str</i> in place, using the same rules as * Translates <i>str</i> in place, using the same rules as
* <code>String#tr</code>. Returns <i>str</i>, or <code>nil</code> if no * String#tr. Returns <i>str</i>, or <code>nil</code> if no changes
* changes were made. * were made.
*/ */
static VALUE static VALUE
@ -7378,7 +7379,7 @@ rb_str_delete_bang(int argc, VALUE *argv, VALUE str)
* *
* Returns a copy of <i>str</i> with all characters in the intersection of its * Returns a copy of <i>str</i> with all characters in the intersection of its
* arguments deleted. Uses the same rules for building the set of characters as * arguments deleted. Uses the same rules for building the set of characters as
* <code>String#count</code>. * String#count.
* *
* "hello".delete "l","lo" #=> "heo" * "hello".delete "l","lo" #=> "heo"
* "hello".delete "lo" #=> "he" * "hello".delete "lo" #=> "he"
@ -7483,11 +7484,11 @@ rb_str_squeeze_bang(int argc, VALUE *argv, VALUE str)
* call-seq: * call-seq:
* str.squeeze([other_str]*) -> new_str * str.squeeze([other_str]*) -> new_str
* *
* Builds a set of characters from the <i>other_str</i> parameter(s) using the * Builds a set of characters from the <i>other_str</i> parameter(s)
* procedure described for <code>String#count</code>. Returns a new string * using the procedure described for String#count. Returns a new
* where runs of the same character that occur in this set are replaced by a * string where runs of the same character that occur in this set are
* single character. If no arguments are given, all runs of identical * replaced by a single character. If no arguments are given, all
* characters are replaced by a single character. * runs of identical characters are replaced by a single character.
* *
* "yellow moon".squeeze #=> "yelow mon" * "yellow moon".squeeze #=> "yelow mon"
* " now is the".squeeze(" ") #=> " now is the" * " now is the".squeeze(" ") #=> " now is the"
@ -7507,7 +7508,7 @@ rb_str_squeeze(int argc, VALUE *argv, VALUE str)
* call-seq: * call-seq:
* str.tr_s!(from_str, to_str) -> str or nil * str.tr_s!(from_str, to_str) -> str or nil
* *
* Performs <code>String#tr_s</code> processing on <i>str</i> in place, * Performs String#tr_s processing on <i>str</i> in place,
* returning <i>str</i>, or <code>nil</code> if no changes were made. * returning <i>str</i>, or <code>nil</code> if no changes were made.
*/ */
@ -7522,8 +7523,8 @@ rb_str_tr_s_bang(VALUE str, VALUE src, VALUE repl)
* call-seq: * call-seq:
* str.tr_s(from_str, to_str) -> new_str * str.tr_s(from_str, to_str) -> new_str
* *
* Processes a copy of <i>str</i> as described under <code>String#tr</code>, * Processes a copy of <i>str</i> as described under String#tr, then
* then removes duplicate characters in regions that were affected by the * removes duplicate characters in regions that were affected by the
* translation. * translation.
* *
* "hello".tr_s('l', 'r') #=> "hero" * "hello".tr_s('l', 'r') #=> "hero"
@ -7705,12 +7706,12 @@ split_string(VALUE result, VALUE str, long beg, long len, long empty_count)
* Divides <i>str</i> into substrings based on a delimiter, returning an array * Divides <i>str</i> into substrings based on a delimiter, returning an array
* of these substrings. * of these substrings.
* *
* If <i>pattern</i> is a <code>String</code>, then its contents are used as * If <i>pattern</i> is a String, then its contents are used as
* the delimiter when splitting <i>str</i>. If <i>pattern</i> is a single * the delimiter when splitting <i>str</i>. If <i>pattern</i> is a single
* space, <i>str</i> is split on whitespace, with leading and trailing * space, <i>str</i> is split on whitespace, with leading and trailing
* whitespace and runs of contiguous whitespace characters ignored. * whitespace and runs of contiguous whitespace characters ignored.
* *
* If <i>pattern</i> is a <code>Regexp</code>, <i>str</i> is divided where the * If <i>pattern</i> is a Regexp, <i>str</i> is divided where the
* pattern matches. Whenever the pattern matches a zero-length string, * pattern matches. Whenever the pattern matches a zero-length string,
* <i>str</i> is split into individual characters. If <i>pattern</i> contains * <i>str</i> is split into individual characters. If <i>pattern</i> contains
* groups, the respective matches will be returned in the array as well. * groups, the respective matches will be returned in the array as well.
@ -8371,7 +8372,7 @@ rb_str_enumerate_codepoints(VALUE str, VALUE ary)
* str.each_codepoint {|integer| block } -> str * str.each_codepoint {|integer| block } -> str
* str.each_codepoint -> an_enumerator * str.each_codepoint -> an_enumerator
* *
* Passes the <code>Integer</code> ordinal of each character in <i>str</i>, * Passes the Integer ordinal of each character in <i>str</i>,
* also known as a <i>codepoint</i> when applied to Unicode strings to the * also known as a <i>codepoint</i> when applied to Unicode strings to the
* given block. For encodings other than UTF-8/UTF-16(BE|LE)/UTF-32(BE|LE), * given block. For encodings other than UTF-8/UTF-16(BE|LE)/UTF-32(BE|LE),
* values are directly derived from the binary representation * values are directly derived from the binary representation
@ -8397,7 +8398,7 @@ rb_str_each_codepoint(VALUE str)
* call-seq: * call-seq:
* str.codepoints -> an_array * str.codepoints -> an_array
* *
* Returns an array of the <code>Integer</code> ordinals of the * Returns an array of the Integer ordinals of the
* characters in <i>str</i>. This is a shorthand for * characters in <i>str</i>. This is a shorthand for
* <code>str.each_codepoint.to_a</code>. * <code>str.each_codepoint.to_a</code>.
* *
@ -8562,9 +8563,9 @@ chopped_length(VALUE str)
* call-seq: * call-seq:
* str.chop! -> str or nil * str.chop! -> str or nil
* *
* Processes <i>str</i> as for <code>String#chop</code>, returning <i>str</i>, * Processes <i>str</i> as for String#chop, returning <i>str</i>, or
* or <code>nil</code> if <i>str</i> is the empty string. See also * <code>nil</code> if <i>str</i> is the empty string. See also
* <code>String#chomp!</code>. * String#chomp!.
*/ */
static VALUE static VALUE
@ -8589,11 +8590,12 @@ rb_str_chop_bang(VALUE str)
* call-seq: * call-seq:
* str.chop -> new_str * str.chop -> new_str
* *
* Returns a new <code>String</code> with the last character removed. If the * Returns a new String with the last character removed. If the
* string ends with <code>\r\n</code>, both characters are removed. Applying * string ends with <code>\r\n</code>, both characters are
* <code>chop</code> to an empty string returns an empty * removed. Applying <code>chop</code> to an empty string returns an
* string. <code>String#chomp</code> is often a safer alternative, as it leaves * empty string. String#chomp is often a safer alternative, as it
* the string unchanged if it doesn't end in a record separator. * leaves the string unchanged if it doesn't end in a record
* separator.
* *
* "string\r\n".chop #=> "string" * "string\r\n".chop #=> "string"
* "string\n\r".chop #=> "string\n" * "string\n\r".chop #=> "string\n"
@ -8746,8 +8748,9 @@ rb_str_chomp_string(VALUE str, VALUE rs)
* call-seq: * call-seq:
* str.chomp!(separator=$/) -> str or nil * str.chomp!(separator=$/) -> str or nil
* *
* Modifies <i>str</i> in place as described for <code>String#chomp</code>, * Modifies <i>str</i> in place as described for String#chomp,
* returning <i>str</i>, or <code>nil</code> if no modifications were made. * returning <i>str</i>, or <code>nil</code> if no modifications were
* made.
*/ */
static VALUE static VALUE
@ -8766,7 +8769,7 @@ rb_str_chomp_bang(int argc, VALUE *argv, VALUE str)
* call-seq: * call-seq:
* str.chomp(separator=$/) -> new_str * str.chomp(separator=$/) -> new_str
* *
* Returns a new <code>String</code> with the given record separator removed * Returns a new String with the given record separator removed
* from the end of <i>str</i> (if present). If <code>$/</code> has not been * from the end of <i>str</i> (if present). If <code>$/</code> has not been
* changed from the default Ruby record separator, then <code>chomp</code> also * changed from the default Ruby record separator, then <code>chomp</code> also
* removes carriage return characters (that is it will remove <code>\n</code>, * removes carriage return characters (that is it will remove <code>\n</code>,
@ -9104,7 +9107,7 @@ scan_once(VALUE str, VALUE pat, long *start, int set_backref_str)
* str.scan(pattern) {|match, ...| block } -> str * str.scan(pattern) {|match, ...| block } -> str
* *
* Both forms iterate through <i>str</i>, matching the pattern (which may be a * Both forms iterate through <i>str</i>, matching the pattern (which may be a
* <code>Regexp</code> or a <code>String</code>). For each match, a result is * Regexp or a String). For each match, a result is
* generated and either added to the result array or passed to the block. If * generated and either added to the result array or passed to the block. If
* the pattern contains no groups, each individual result consists of the * the pattern contains no groups, each individual result consists of the
* matched string, <code>$&</code>. If the pattern contains groups, each * matched string, <code>$&</code>. If the pattern contains groups, each
@ -9241,9 +9244,9 @@ rb_str_oct(VALUE str)
* detectable. * detectable.
* *
* * For instance, in the following example, the second invocation * * For instance, in the following example, the second invocation
* of <code>String#crypt</code> is wrong; it has a typo in * of String#crypt is wrong; it has a typo in "round=" (lacks
* "round=" (lacks "s"). However the call does not fail and * "s"). However the call does not fail and something unexpected
* something unexpected is generated. * is generated.
* *
* "foo".crypt("$5$rounds=1000$salt$") # OK, proper usage * "foo".crypt("$5$rounds=1000$salt$") # OK, proper usage
* "foo".crypt("$5$round=1000$salt$") # Typo not detected * "foo".crypt("$5$round=1000$salt$") # Typo not detected
@ -9330,7 +9333,7 @@ rb_str_crypt(VALUE str, VALUE salt)
* call-seq: * call-seq:
* str.ord -> integer * str.ord -> integer
* *
* Returns the <code>Integer</code> ordinal of a one-character string. * Returns the Integer ordinal of a one-character string.
* *
* "a".ord #=> 97 * "a".ord #=> 97
*/ */
@ -9348,7 +9351,7 @@ rb_str_ord(VALUE s)
* str.sum(n=16) -> integer * str.sum(n=16) -> integer
* *
* Returns a basic <em>n</em>-bit checksum of the characters in <i>str</i>, * Returns a basic <em>n</em>-bit checksum of the characters in <i>str</i>,
* where <em>n</em> is the optional <code>Integer</code> parameter, defaulting * where <em>n</em> is the optional Integer parameter, defaulting
* to 16. The result is simply the sum of the binary value of each byte in * to 16. The result is simply the sum of the binary value of each byte in
* <i>str</i> modulo <code>2**n - 1</code>. This is not a particularly good * <i>str</i> modulo <code>2**n - 1</code>. This is not a particularly good
* checksum. * checksum.
@ -9507,7 +9510,7 @@ rb_str_justify(int argc, VALUE *argv, VALUE str, char jflag)
* str.ljust(integer, padstr=' ') -> new_str * str.ljust(integer, padstr=' ') -> new_str
* *
* If <i>integer</i> is greater than the length of <i>str</i>, returns a new * If <i>integer</i> is greater than the length of <i>str</i>, returns a new
* <code>String</code> of length <i>integer</i> with <i>str</i> left justified * String of length <i>integer</i> with <i>str</i> left justified
* and padded with <i>padstr</i>; otherwise, returns <i>str</i>. * and padded with <i>padstr</i>; otherwise, returns <i>str</i>.
* *
* "hello".ljust(4) #=> "hello" * "hello".ljust(4) #=> "hello"
@ -9527,7 +9530,7 @@ rb_str_ljust(int argc, VALUE *argv, VALUE str)
* str.rjust(integer, padstr=' ') -> new_str * str.rjust(integer, padstr=' ') -> new_str
* *
* If <i>integer</i> is greater than the length of <i>str</i>, returns a new * If <i>integer</i> is greater than the length of <i>str</i>, returns a new
* <code>String</code> of length <i>integer</i> with <i>str</i> right justified * String of length <i>integer</i> with <i>str</i> right justified
* and padded with <i>padstr</i>; otherwise, returns <i>str</i>. * and padded with <i>padstr</i>; otherwise, returns <i>str</i>.
* *
* "hello".rjust(4) #=> "hello" * "hello".rjust(4) #=> "hello"
@ -10450,17 +10453,15 @@ rb_str_unicode_normalized_p(int argc, VALUE *argv, VALUE str)
/********************************************************************** /**********************************************************************
* Document-class: Symbol * Document-class: Symbol
* *
* <code>Symbol</code> objects represent names and some strings * Symbol objects represent names and some strings inside the Ruby
* inside the Ruby
* interpreter. They are generated using the <code>:name</code> and * interpreter. They are generated using the <code>:name</code> and
* <code>:"string"</code> literals * <code>:"string"</code> literals syntax, and by the various
* syntax, and by the various <code>to_sym</code> methods. The same * <code>to_sym</code> methods. The same Symbol object will be
* <code>Symbol</code> object will be created for a given name or string * created for a given name or string for the duration of a program's
* for the duration of a program's execution, regardless of the context * execution, regardless of the context or meaning of that name. Thus
* or meaning of that name. Thus if <code>Fred</code> is a constant in * if <code>Fred</code> is a constant in one context, a method in
* one context, a method in another, and a class in a third, the * another, and a class in a third, the Symbol <code>:Fred</code>
* <code>Symbol</code> <code>:Fred</code> will be the same object in * will be the same object in all three contexts.
* all three contexts.
* *
* module One * module One
* class Fred * class Fred
@ -10617,7 +10618,7 @@ rb_sym_to_s(VALUE sym)
* sym.to_sym -> sym * sym.to_sym -> sym
* sym.intern -> sym * sym.intern -> sym
* *
* In general, <code>to_sym</code> returns the <code>Symbol</code> corresponding * In general, <code>to_sym</code> returns the Symbol corresponding
* to an object. As <i>sym</i> is already a symbol, <code>self</code> is returned * to an object. As <i>sym</i> is already a symbol, <code>self</code> is returned
* in this case. * in this case.
*/ */
@ -10697,7 +10698,7 @@ sym_cmp(VALUE sym, VALUE other)
* call-seq: * call-seq:
* sym.casecmp(other_symbol) -> -1, 0, +1, or nil * sym.casecmp(other_symbol) -> -1, 0, +1, or nil
* *
* Case-insensitive version of <code>Symbol#<=></code>. * Case-insensitive version of Symbol#<=>.
* Currently, case-insensitivity only works on characters A-Z/a-z, * Currently, case-insensitivity only works on characters A-Z/a-z,
* not all of Unicode. This is different from Symbol#casecmp?. * not all of Unicode. This is different from Symbol#casecmp?.
* *
@ -10939,15 +10940,15 @@ rb_to_symbol(VALUE name)
} }
/* /*
* A <code>String</code> object holds and manipulates an arbitrary sequence of * A String object holds and manipulates an arbitrary sequence of
* bytes, typically representing characters. String objects may be created * bytes, typically representing characters. String objects may be created
* using <code>String::new</code> or as literals. * using String::new or as literals.
* *
* Because of aliasing issues, users of strings should be aware of the methods * Because of aliasing issues, users of strings should be aware of the methods
* that modify the contents of a <code>String</code> object. Typically, * that modify the contents of a String object. Typically,
* methods with names ending in ``!'' modify their receiver, while those * methods with names ending in ``!'' modify their receiver, while those
* without a ``!'' return a new <code>String</code>. However, there are * without a ``!'' return a new String. However, there are
* exceptions, such as <code>String#[]=</code>. * exceptions, such as String#[]=.
* *
*/ */