String
ruby/spec describes 153 methods in core/string, and Metorex implements 138 of them. The parameters are what Method#parameters answers under Metorex.
String#%: implemented, parameters[[:req]]. Returns the result of formattingobjectinto the format specifications contained inself(see Format Specifications):String#*: implemented, parameters[[:req]]. Returns a new string containingncopies ofself:String#+: implemented, parameters[[:req]]. Returns a new string containingother_stringconcatenated toself:String#+@: implemented, parameters[]. Returnsselfifselfis not frozen and can be mutated without warning issuance.String#-@: implemented, parameters[]. Returns a frozen string equal toself.String#<<: implemented, parameters[[:req]]. Appends a string representation ofobjecttoself; returnsself.String#<=>: implemented, parameters[[:req]]. Comparesselfandother, evaluating their contents, not their lengths.String#==: implemented, parameters[[:req]]. Returns whetherobjectis equal toself.String#===: implemented, parameters[[:req]]. Returns whetherobjectis equal toself.String#=~: implemented, parameters[[:req]]. Whenobjectis a Regexp, returns the index of the first substring inselfmatched byobject, ornilif no match is found; updates Regexp-related global variables:String#[]: implemented, parameters[[:rest]]. Returns the substring ofselfspecified by the arguments.String#[]=: implemented, parameters[[:rest]]. Returnsselfwith all, a substring, or none of its contents replaced; returns the argumentother_string.String.allocate: implemented, parameters[[:req, :args]].String#append_bytes: not implemented.String#ascii_only?: implemented, parameters[]. Returns whetherselfcontains only ASCII characters: An example calling it.String#b: implemented, parameters[]. Returns a copy ofselfthat has ASCII-8BIT encoding; the underlying bytes are not modified: An example calling it.String#bit_clear: not implemented.String#bit_count: not implemented.String#bit_flip: not implemented.String#bit_get: not implemented.String#bit_set: not implemented.String#bit_set?: not implemented.String#bitwise_and: not implemented.String#bitwise_and!: not implemented.String#bitwise_not: not implemented.String#bitwise_not!: not implemented.String#bitwise_or: not implemented.String#bitwise_or!: not implemented.String#bitwise_xor: not implemented.String#bitwise_xor!: not implemented.String#byteindex: implemented, parameters[[:rest]]. Returns the 0-based integer index of a substring ofselfspecified byobject(a string or Regexp) andoffset, ornilif there is no such substring; the returned index is the count of bytes (not characters). An example calling it.String#byterindex: implemented, parameters[[:rest]]. Returns the 0-based integer index of a substring ofselfthat is the last match for the givenobject(a string or Regexp) andoffset, ornilif there is no such substring; the returned index is the count of bytes (not characters). An example calling it.String#bytes: implemented, parameters[]. Returns an array of the bytes inself: An example calling it.String#bytesize: implemented, parameters[]. Returns the count of bytes inself. An example calling it.String#byteslice: implemented, parameters[[:rest]]. Returns a substring ofself, ornilif the substring cannot be constructed. An example calling it.String#bytesplice: implemented, parameters[[:rest]]. Replaces target bytes inselfwith source bytes from the given stringstr; returnsself. An example calling it.String#capitalize: implemented, parameters[[:rest]]. Returns a string containing the characters inself, each with possibly changed case: An example calling it.String#capitalize!: implemented, parameters[[:rest]]. Like String#capitalize, except that:String#casecmp: implemented, parameters[[:req]]. Ignoring case, comparesselfandother_string; returns: An example calling it.String#casecmp?: implemented, parameters[[:req]]. Returnstrueifselfandother_stringare equal after Unicode case folding,falseif unequal,nilif incomparable. An example calling it.String#center: implemented, parameters[[:rest]]. Returns a centered copy ofself. An example calling it.String#chars: implemented, parameters[]. Returns an array of the characters inself: An example calling it.String#chomp: implemented, parameters[[:rest]]. Returns a new string copied fromself, with trailing characters possibly removed: An example calling it.String#chomp!: implemented, parameters[[:rest]]. Like String#chomp, except that: An example calling it.String#chop: implemented, parameters[]. Returns a new string copied fromself, with trailing characters possibly removed. An example calling it.String#chop!: implemented, parameters[]. Like String#chop, except that:String#chr: implemented, parameters[]. Returns a string containing the first character ofself: An example calling it.String#clear: implemented, parameters[]. Removes the contents ofself: An example calling it.String#clone: implemented, parameters[[:rest, :args]]. Produces a shallow copy of obj---the instance variables of obj are copied, but not the objects they reference. An example calling it.String#codepoints: implemented, parameters[]. Returns an array of the codepoints inself; each codepoint is the integer value for a character: An example calling it.String#concat: implemented, parameters[[:rest]]. Concatenates each object inobjectstoself; returnsself: An example calling it.String#count: implemented, parameters[[:rest]]. Returns the total number of characters inselfthat are specified by the given selectors. An example calling it.String#crypt: implemented, parameters[[:req]]. Returns the string generated by callingcrypt(3)standard library function withstrandsalt_str, in this order, as its arguments. An example calling it.String#dedup: implemented, parameters[]. Returns a frozen string equal toself.String#delete: implemented, parameters[[:rest]]. Returns a new string that is a copy ofselfwith certain characters removed; the removed characters are all instances of those specified by the given stringselectors. An example calling it.String#delete!: implemented, parameters[[:rest]]. Like String#delete, but modifiesselfin place; returnsselfif any characters were deleted,nilotherwise. An example calling it.String#delete_prefix: implemented, parameters[[:req]]. Returns a copy ofselfwith leading substringprefixremoved: An example calling it.String#delete_prefix!: implemented, parameters[[:req]]. Like String#delete_prefix, except thatselfis modified in place; returnsselfif the prefix is removed,nilotherwise. An example calling it.String#delete_suffix: implemented, parameters[[:req]]. Returns a copy ofselfwith trailing substringsuffixremoved: An example calling it.String#delete_suffix!: implemented, parameters[[:req]]. Like String#delete_suffix, except thatselfis modified in place; returnsselfif the suffix is removed,nilotherwise. An example calling it.String#downcase: implemented, parameters[[:rest]]. Returns a new string containing the downcased characters inself: An example calling it.String#downcase!: implemented, parameters[[:rest]]. Like String#downcase, except that: An example calling it.String#dump: implemented, parameters[]. For an ordinary string, this method, +String#dump+, returns a printable ASCII-only version ofself, enclosed in double-quotes. An example calling it.String#dup: implemented, parameters[]. Produces a shallow copy of obj---the instance variables of obj are copied, but not the objects they reference. An example calling it.String#each_byte: implemented, parameters[]. With a block given, calls the block with each successive byte fromself; returnsself: An example calling it.String#each_char: implemented, parameters[]. With a block given, calls the block with each successive character fromself; returnsself: An example calling it.String#each_codepoint: implemented, parameters[]. With a block given, calls the block with each successive codepoint fromself; each codepoint is the integer value for a character; returnsself: An example calling it.String#each_grapheme_cluster: implemented, parameters[]. With a block given, calls the given block with each successive grapheme cluster fromself(see Unicode Grapheme Cluster Boundaries ); returnsself:String#each_line: implemented, parameters[[:rest]]. With a block given, forms the substrings (lines) that are the result of splittingselfat each occurrence of the givenrecord_separator; passes each line to the block; returnsself. An example calling it.String#empty?: implemented, parameters[]. Returns whether the length ofselfis zero: An example calling it.String#encode: implemented, parameters[[:rest]]. Returns a copy ofselftranscoded as determined bydst_encoding; see Encodings. An example calling it.String#encode!: implemented, parameters[[:rest]]. Like #encode, but applies encoding changes toself; returnsself. An example calling it.String#encoding: implemented, parameters[]. Returns an Encoding object that represents the encoding ofself; see Encodings. An example calling it.String#end_with?: implemented, parameters[[:rest]]. Returns whetherselfends with any of the givenstrings: An example calling it.String#eql?: implemented, parameters[[:req]]. Returns whetherselfandobjecthave the same length and content: An example calling it.String#force_encoding: implemented, parameters[[:req]]. Changes the encoding ofselfto the givenencoding, which may be a string encoding name or an Encoding object; does not change the underlying bytes; returns self: An example calling it.String#freeze: implemented, parameters[]. Prevents further modifications to obj. An example calling it.String#getbyte: implemented, parameters[[:req]]. Returns the byte at zero-basedindexas an integer: An example calling it.String#grapheme_clusters: implemented, parameters[]. Returns an array of the grapheme clusters inself(see Unicode Grapheme Cluster Boundaries ):String#gsub: implemented, parameters[[:rest]]. Returns a copy ofselfwith zero or more substrings replaced. An example calling it.String#gsub!: implemented, parameters[[:rest]]. Like String#gsub, except that: An example calling it.String#hash: implemented, parameters[]. Returns the integer hash value forself. An example calling it.String#hex: implemented, parameters[]. Interprets the leading substring ofselfas hexadecimal, possibly signed; returns its value as an integer. An example calling it.String#include?: implemented, parameters[[:req]]. Returns whetherselfcontainsother_string: An example calling it.String#index: implemented, parameters[[:rest]]. Returns the integer position of the first substring that matches the given argumentpattern, ornilif none found. An example calling it.String#initialize: implemented, parameters[[:opt, :other]]. An example calling it.String#insert: implemented, parameters[[:req], [:req]]. Inserts the givenother_stringintoself; returnsself. An example calling it.String#inspect: implemented, parameters[]. Returns a printable version ofself, enclosed in double-quotes. An example calling it.String#intern: implemented, parameters[]. Returns the Symbol object derived fromself, creating it if it did not already exist: An example calling it.String#length: implemented, parameters[]. Returns the count of characters (not bytes) inself: An example calling it.String#lines: implemented, parameters[[:rest]]. Returns substrings ("lines") ofselfaccording to the given arguments: An example calling it.String#ljust: implemented, parameters[[:rest]]. Returns a copy ofself, left-justified and, if necessary, right-padded with thepad_string: An example calling it.String#lstrip: implemented, parameters[[:rest]]. Returns a copy ofselfwith leading whitespace removed; see Whitespace in Strings: An example calling it.String#lstrip!: implemented, parameters[[:rest]]. Like String#lstrip, except that:String#match: implemented, parameters[[:rest]]. Creates a MatchData object based onselfand the given arguments; updates Regexp Global Variables. An example calling it.String#match?: implemented, parameters[[:rest]]. Returns whether a match is found forselfand the given arguments; does not update Regexp Global Variables. An example calling it.String.new: implemented, parameters[[:rest]]. Returns a new String object containing the givenstring. An example calling it.String#next: implemented, parameters[]. Returns the successor toself. An example calling it.String#next!: implemented, parameters[]. Like String#succ, but modifiesselfin place; returnsself.String#oct: implemented, parameters[]. Interprets the leading substring ofselfas octal, binary, decimal, or hexadecimal, possibly signed; returns their value as an integer. An example calling it.String#ord: implemented, parameters[]. Returns the integer ordinal of the first character ofself: An example calling it.String#partition: implemented, parameters[[:req]]. Returns a 3-element array of substrings ofself. An example calling it.String#prepend: implemented, parameters[[:rest]]. Prefixes toselfthe concatenation of the givenother_strings; returnsself: An example calling it.String#replace: implemented, parameters[[:req]]. Replaces the contents ofselfwith the contents ofother_string; returnsself: An example calling it.String#reverse: implemented, parameters[]. Returns a new string with the characters fromselfin reverse order. An example calling it.String#reverse!: implemented, parameters[]. Returnsselfwith its characters reversed: An example calling it.String#rindex: implemented, parameters[[:rest]]. Returns the integer position of the last substring that matches the given argumentpattern, ornilif none found. An example calling it.String#rjust: implemented, parameters[[:rest]]. Returns a right-justified copy ofself. An example calling it.String#rpartition: implemented, parameters[[:req]]. Returns a 3-element array of substrings ofself. An example calling it.String#rstrip: implemented, parameters[[:rest]]. Returns a copy ofselfwith trailing whitespace removed; see Whitespace in Strings: An example calling it.String#rstrip!: implemented, parameters[[:rest]]. Like String#rstrip, except that:String#scan: implemented, parameters[[:req]]. Matches a pattern againstself: An example calling it.String#scrub: implemented, parameters[[:rest]]. Returns a copy ofselfwith each invalid byte sequence replaced by the givenreplacement_string.String#scrub!: implemented, parameters[[:rest]]. Like String#scrub, except that: An example calling it.String#setbyte: implemented, parameters[[:req], [:req]]. Sets the byte at zero-based offsetindexto the value of the giveninteger; returnsinteger: An example calling it.String#size: implemented, parameters[]. Returns the count of characters (not bytes) inself: An example calling it.String#slice: implemented, parameters[[:rest]]. Returns the substring ofselfspecified by the arguments. An example calling it.String#slice!: implemented, parameters[[:rest]]. Like String#[] (and its alias String#slice), except that: An example calling it.String#split: implemented, parameters[[:rest]]. Creates an array of substrings by splittingselfat each occurrence of the given field separatorfield_sep. An example calling it.String#squeeze: implemented, parameters[[:rest]]. Returns a copy ofselfwith each tuple (doubling, tripling, etc.) of specified characters "squeezed" down to a single character. An example calling it.String#squeeze!: implemented, parameters[[:rest]]. Like String#squeeze, except that:String#start_with?: implemented, parameters[[:rest]]. Returns whetherselfstarts with any of the givenpatterns. An example calling it.String#strip: implemented, parameters[[:rest]]. Returns a copy ofselfwith leading and trailing whitespace removed; see Whitespace in Strings: An example calling it.String#strip!: implemented, parameters[[:rest]]. Like String#strip, except that: An example calling it.String#sub: implemented, parameters[[:rest]]. Returns a copy of self, possibly with a substring replaced. An example calling it.String#sub!: implemented, parameters[[:rest]]. Like String#sub, except that: An example calling it.String#succ: implemented, parameters[]. Returns the successor toself. An example calling it.String#succ!: implemented, parameters[]. Like String#succ, but modifiesselfin place; returnsself.String#sum: implemented, parameters[[:rest]]. Returns a basicn-bit checksum of the characters inself; the checksum is the sum of the binary value of each byte inself, modulo2**n - 1: An example calling it.String#swapcase: implemented, parameters[[:rest]]. Returns a string containing the characters inself, with cases reversed: An example calling it.String#swapcase!: implemented, parameters[[:rest]]. Like String#swapcase, except that:String#to_c: implemented, parameters[]. Returns a Complex object: parses the leading substring ofselfto extract two numeric values that become the coordinates of the complex object. An example calling it.String#to_f: implemented, parameters[]. See Converting to Non-String. An example calling it.String#to_i: implemented, parameters[[:rest]]. Returns the result of interpreting leading characters inselfas an integer in the givenbase;basemust be either0or in range(2..36): An example calling it.String#to_r: implemented, parameters[]. Returns the result of interpreting leading characters inselfas a rational value: An example calling it.String#to_s: implemented, parameters[]. Returnsselfifselfis aString, orselfconverted to aStringifselfis a subclass ofString. An example calling it.String#to_str: implemented, parameters[]. Returnsselfifselfis aString, orselfconverted to aStringifselfis a subclass ofString. An example calling it.String#to_sym: implemented, parameters[]. Returns the Symbol object derived fromself, creating it if it did not already exist: An example calling it.String#tr: implemented, parameters[[:req], [:req]]. Returns a copy ofselfwith each character specified by stringselectortranslated to the corresponding character in stringreplacements. An example calling it.String#tr!: implemented, parameters[[:req], [:req]]. Like String#tr, except:String#tr_s: implemented, parameters[[:req], [:req]]. Like String#tr, except: An example calling it.String#tr_s!: implemented, parameters[[:req], [:req]]. Like String#tr_s, except:String.try_convert: implemented, parameters[[:req, :args]]. Attempts to convert the givenobjectto a string. An example calling it.String#undump: implemented, parameters[]. Inverse of String#dump; returns a copy ofselfwith changes of the kinds made by String#dump "undone."String#unicode_normalize: implemented, parameters[[:rest]]. Returns a copy ofselfwith Unicode normalization applied. An example calling it.String#unicode_normalize!: implemented, parameters[[:rest]]. Like String#unicode_normalize, except that the normalization is performed onself(not on a copy ofself). An example calling it.String#unicode_normalized?: implemented, parameters[[:rest]]. Returns whetherselfis in the givenformof Unicode normalization; see String#unicode_normalize. An example calling it.String#unpack: implemented, parameters[[:rest, :args]]. Extracts data fromselfto form new objects; see Packed Data. An example calling it.String#unpack1: implemented, parameters[[:rest, :args]]. Like String#unpack with no block, but unpacks and returns only the first extracted object. An example calling it.String#upcase: implemented, parameters[[:rest]]. Returns a new string containing the upcased characters inself: An example calling it.String#upcase!: implemented, parameters[[:rest]]. Like String#upcase, except that: An example calling it.String#upto: implemented, parameters[[:rest]]. With a block given, calls the block with eachStringvalue returned by successive calls to String#succ; the first value isself, the next isself.succ, and so on; the sequence terminates when valueother_stringis reached; returnsself: An example calling it.String#valid_encoding?: implemented, parameters[]. Returns whetherselfis encoded correctly: An example calling it.
The method summaries are the first sentences of Ruby's own documentation for each method, read from MRI 4.0.6's ri data. Ruby's documentation is distributed under Ruby's license.