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