Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions doc/language/packed_data.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -457,15 +457,15 @@ for one byte in the input or output string.
"foo ".unpack('A4') # => ["foo"]
"foo".unpack('A4') # => ["foo"]

russian = "\u{442 435 441 442}" # => "тест"
russian.size # => 4
russian.bytesize # => 8
[russian].pack('A') # => "\xD1"
[russian].pack('A*') # => "\xD1\x82\xD0\xB5\xD1\x81\xD1\x82"
russian.unpack('A') # => ["\xD1"]
russian.unpack('A2') # => ["\xD1\x82"]
russian.unpack('A4') # => ["\xD1\x82\xD0\xB5"]
russian.unpack('A*') # => ["\xD1\x82\xD0\xB5\xD1\x81\xD1\x82"]
japanese = 'こんにちは'
japanese.size # => 5
japanese.bytesize # => 15
[japanese].pack('A') # => "\xE3"
[japanese].pack('A*') # => "\xE3\x81\x93\xE3\x82\x93\xE3\x81\xAB\xE3\x81\xA1\xE3\x81\xAF"
japanese.unpack('A') # => ["\xE3"]
japanese.unpack('A2') # => ["\xE3\x81"]
japanese.unpack('A4') # => ["\xE3\x81\x93\xE3"]
japanese.unpack('A*') # => ["\xE3\x81\x93\xE3\x82\x93\xE3\x81\xAB\xE3\x81\xA1\xE3\x81\xAF"]

- <tt>'a'</tt> - Arbitrary binary string (null padded; count is width):

Expand Down
2 changes: 0 additions & 2 deletions doc/string/aref.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ returns the 1-character substring found in self at character offset index:
'hello'[0] # => "h"
'hello'[4] # => "o"
'hello'[5] # => nil
'Привет'[2] # => "и"
'こんにちは'[4] # => "は"

With negative integer argument +index+ given,
Expand Down Expand Up @@ -92,7 +91,6 @@ returns the matching substring of +self+, if found:
'hello'['ell'] # => "ell"
'hello'[''] # => ""
'hello'['nosuch'] # => nil
'Привет'['ив'] # => "ив"
'こんにちは'['んにち'] # => "んにち"

Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].
4 changes: 0 additions & 4 deletions doc/string/aset.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,6 @@ With string argument +substring+ given:
s['ll'] = 'foo' # => "foo"
s # => "hefooo"

s = 'Привет'
s['ив'] = 'foo' # => "foo"
s # => "Прfooет"

s = 'こんにちは'
s['んにち'] = 'foo' # => "foo"
s # => "こfooは"
Expand Down
1 change: 0 additions & 1 deletion doc/string/bytes.rdoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Returns an array of the bytes in +self+:

'hello'.bytes # => [104, 101, 108, 108, 111]
'Привет'.bytes # => [208, 159, 209, 128, 208, 184, 208, 178, 208, 181, 209, 130]
'こんにちは'.bytes
# => [227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]

Expand Down
3 changes: 0 additions & 3 deletions doc/string/bytesize.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ Note that the byte count may be different from the character count (returned by
s = 'foo'
s.bytesize # => 3
s.size # => 3
s = 'Привет'
s.bytesize # => 12
s.size # => 6
s = 'こんにちは'
s.bytesize # => 15
s.size # => 5
Expand Down
2 changes: 0 additions & 2 deletions doc/string/capitalize.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ Examples:
'HELLO'.capitalize # => "Hello"
'straße'.capitalize # => "Straße" # Lowercase 'ß' not changed.
'STRAẞE'.capitalize # => "Straße" # Uppercase 'ẞ' downcased to 'ß'.
'привет'.capitalize # => "Привет"
'ПРИВЕТ'.capitalize # => "Привет"

Some characters (and some character sets) do not have upcase and downcase versions;
see {Case Mapping}[rdoc-ref:case_mapping.rdoc]:
Expand Down
1 change: 0 additions & 1 deletion doc/string/center.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ centered and padded on one or both ends with +pad_string+:
'hello'.center(20, '-|') # => "-|-|-|-hello-|-|-|-|" # Some padding repeated.
'hello'.center(10, 'abcdefg') # => "abhelloabc" # Some padding not used.
' hello '.center(13) # => " hello "
'Привет'.center(10) # => " Привет "
'こんにちは'.center(10) # => " こんにちは " # Multi-byte characters.

If +size+ is less than or equal to the size of +self+, returns an unpadded copy of +self+:
Expand Down
1 change: 0 additions & 1 deletion doc/string/chars.rdoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Returns an array of the characters in +self+:

'hello'.chars # => ["h", "e", "l", "l", "o"]
'Привет'.chars # => ["П", "р", "и", "в", "е", "т"]
'こんにちは'.chars # => ["こ", "ん", "に", "ち", "は"]
''.chars # => []

Expand Down
1 change: 0 additions & 1 deletion doc/string/chomp.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ if they are <tt>"\r"</tt>, <tt>"\n"</tt>, or <tt>"\r\n"</tt>
"abc\n".chomp # => "abc"
"abc\r\n".chomp # => "abc"
"abc\n\r".chomp # => "abc\n"
"тест\r\n".chomp # => "тест"
"こんにちは\r\n".chomp # => "こんにちは"

When +line_sep+ is <tt>''</tt> (an empty string),
Expand Down
2 changes: 0 additions & 2 deletions doc/string/chop.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ Returns a new string copied from +self+, with trailing characters possibly remov
Removes <tt>"\r\n"</tt> if those are the last two characters.

"abc\r\n".chop # => "abc"
"тест\r\n".chop # => "тест"
"こんにちは\r\n".chop # => "こんにちは"

Otherwise removes the last character if it exists.

'abcd'.chop # => "abc"
'тест'.chop # => "тес"
'こんにちは'.chop # => "こんにち"
''.chop # => ""

Expand Down
1 change: 0 additions & 1 deletion doc/string/chr.rdoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Returns a string containing the first character of +self+:

'hello'.chr # => "h"
'тест'.chr # => "т"
'こんにちは'.chr # => "こ"
''.chr # => ""

Expand Down
1 change: 0 additions & 1 deletion doc/string/codepoints.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Returns an array of the codepoints in +self+;
each codepoint is the integer value for a character:

'hello'.codepoints # => [104, 101, 108, 108, 111]
'тест'.codepoints # => [1090, 1077, 1089, 1090]
'こんにちは'.codepoints # => [12371, 12435, 12395, 12385, 12399]
''.codepoints # => []

Expand Down
1 change: 0 additions & 1 deletion doc/string/concat.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ For each given object +object+ that is an integer,
the value is considered a codepoint and converted to a character before concatenation:

'foo'.concat(32, 'bar', 32, 'baz') # => "foo bar baz" # Embeds spaces.
'те'.concat(1089, 1090) # => "тест"
'こん'.concat(12395, 12385, 12399) # => "こんにちは"

Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].
4 changes: 0 additions & 4 deletions doc/string/count.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ returns the count of instances of that character:
s.count('x') # => 0
s.count('') # => 0

s = 'тест'
s.count('т') # => 2
s.count('е') # => 1

s = 'よろしくお願いします'
s.count('よ') # => 1
s.count('し') # => 2
Expand Down
4 changes: 0 additions & 4 deletions doc/string/delete.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ removes all instances of that character:
s.delete('x') # => "abracadabra"
s.delete('') # => "abracadabra"

s = 'тест'
s.delete('т') # => "ес"
s.delete('е') # => "тст"

s = 'よろしくお願いします'
s.delete('よ') # => "ろしくお願いします"
s.delete('し') # => "よろくお願います"
Expand Down
1 change: 0 additions & 1 deletion doc/string/delete_prefix.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Returns a copy of +self+ with leading substring +prefix+ removed:
'oof'.delete_prefix('oo') # => "f"
'oof'.delete_prefix('oof') # => ""
'oof'.delete_prefix('x') # => "oof"
'тест'.delete_prefix('те') # => "ст"
'こんにちは'.delete_prefix('こん') # => "にちは"

Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].
1 change: 0 additions & 1 deletion doc/string/delete_suffix.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Returns a copy of +self+ with trailing substring <tt>suffix</tt> removed:
'foo'.delete_suffix('foo') # => ""
'foo'.delete_suffix('f') # => "foo"
'foo'.delete_suffix('x') # => "foo"
'тест'.delete_suffix('ст') # => "те"
'こんにちは'.delete_suffix('ちは') # => "こんに"

Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].
8 changes: 0 additions & 8 deletions doc/string/dump.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ and so contains both outer double-quotes and escaped inner double-quotes:
If +self+ is encoded in UTF-8 and contains Unicode characters,
each Unicode character is dumped as a Unicode escape sequence:

String: тест
Dumped: "\u0442\u0435\u0441\u0442"
Undumped: тест

String: こんにちは
Dumped: "\u3053\u3093\u306B\u3061\u306F"
Undumped: こんにちは
Expand All @@ -88,10 +84,6 @@ where <tt><encoding></tt> is <tt>self.encoding.name</tt>:
Dumped: "\xFE\xFF\x00h\x00e\x00l\x00l\x00o".dup.force_encoding("UTF-16")
Undumped: hello

String: тест
Dumped: "\xFE\xFF\x04B\x045\x04A\x04B".dup.force_encoding("UTF-16")
Undumped: тест

String: こんにちは
Dumped: "\xFE\xFF0S0\x930k0a0o".dup.force_encoding("UTF-16")
Undumped: こんにちは
3 changes: 0 additions & 3 deletions doc/string/each_byte.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ returns +self+:
'hello'.each_byte {|byte| a.push(byte) } # Five 1-byte characters.
a # => [104, 101, 108, 108, 111]
a = []
'тест'.each_byte {|byte| a.push(byte) } # Four 2-byte characters.
a # => [209, 130, 208, 181, 209, 129, 209, 130]
a = []
'こんにちは'.each_byte {|byte| a.push(byte) } # Five 3-byte characters.
a # => [227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]

Expand Down
5 changes: 0 additions & 5 deletions doc/string/each_char.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ returns +self+:
end
a # => ["h", "e", "l", "l", "o"]
a = []
'тест'.each_char do |char|
a.push(char)
end
a # => ["т", "е", "с", "т"]
a = []
'こんにちは'.each_char do |char|
a.push(char)
end
Expand Down
5 changes: 0 additions & 5 deletions doc/string/each_codepoint.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ returns +self+:
end
a # => [104, 101, 108, 108, 111]
a = []
'тест'.each_codepoint do |codepoint|
a.push(codepoint)
end
a # => [1090, 1077, 1089, 1090]
a = []
'こんにちは'.each_codepoint do |codepoint|
a.push(codepoint)
end
Expand Down
6 changes: 0 additions & 6 deletions doc/string/each_grapheme_cluster.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ returns +self+:
end
a # => ["h", "e", "l", "l", "o"]

a = []
'тест'.each_grapheme_cluster do |grapheme_cluster|
a.push(grapheme_cluster)
end
a # => ["т", "е", "с", "т"]

a = []
'こんにちは'.each_grapheme_cluster do |grapheme_cluster|
a.push(grapheme_cluster)
Expand Down
1 change: 0 additions & 1 deletion doc/string/end_with_p.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Returns whether +self+ ends with any of the given +strings+:
'foo'.end_with?('bar', 'oo') # => true
'foo'.end_with?('bar', 'baz') # => false
'foo'.end_with?('') # => true
'тест'.end_with?('т') # => true
'こんにちは'.end_with?('は') # => true

Related: see {Querying}[rdoc-ref:String@Querying].
3 changes: 0 additions & 3 deletions doc/string/getbyte.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ Returns +nil+ if +index+ is out of range:

More examples:

s = 'тест'
s.bytes # => [209, 130, 208, 181, 209, 129, 209, 130]
s.getbyte(2) # => 208
s = 'こんにちは'
s.bytes # => [227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]
s.getbyte(2) # => 147
Expand Down
4 changes: 0 additions & 4 deletions doc/string/index.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ returns the index of the first matching substring in +self+:
'foo'.index('o') # => 1
'foo'.index('oo') # => 1
'foo'.index('ooo') # => nil
'тест'.index('с') # => 2 # Characters, not bytes.
'こんにちは'.index('ち') # => 3

When +pattern+ is a Regexp, returns the index of the first match in +self+:
Expand All @@ -24,9 +23,6 @@ the returned index is relative to the beginning of +self+:
'bar'.index('r', 2) # => 2
'bar'.index('r', 3) # => nil
'bar'.index(/[r-z]/, 0) # => 2
'тест'.index('с', 1) # => 2
'тест'.index('с', 2) # => 2
'тест'.index('с', 3) # => nil # Offset in characters, not bytes.
'こんにちは'.index('ち', 2) # => 3

With negative integer argument +offset+, selects the search position by counting backward
Expand Down
1 change: 0 additions & 1 deletion doc/string/insert.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ If the given +index+ is non-negative, inserts +other_string+ at offset +index+:
'foo'.insert(0, 'bar') # => "barfoo"
'foo'.insert(1, 'bar') # => "fbaroo"
'foo'.insert(3, 'bar') # => "foobar"
'тест'.insert(2, 'bar') # => "теbarст" # Characters, not bytes.
'こんにちは'.insert(2, 'bar') # => "こんbarにちは"

If the +index+ is negative, counts backward from the end of +self+
Expand Down
1 change: 0 additions & 1 deletion doc/string/inspect.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Most printable characters are rendered simply as themselves:
'012'.inspect # => "\"012\""
''.inspect # => "\"\""
"\u000012".inspect # => "\"\\u000012\""
'тест'.inspect # => "\"тест\""
'こんにちは'.inspect # => "\"こんにちは\""

But printable characters double-quote (<tt>'"'</tt>) and backslash and (<tt>'\\'</tt>) are escaped:
Expand Down
1 change: 0 additions & 1 deletion doc/string/intern.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Returns the Symbol object derived from +self+,
creating it if it did not already exist:

'foo'.intern # => :foo
'тест'.intern # => :тест
'こんにちは'.intern # => :こんにちは

Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString].
Expand Down
2 changes: 0 additions & 2 deletions doc/string/length.rdoc
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
Returns the count of characters (not bytes) in +self+:

'foo'.length # => 3
'тест'.length # => 4
'こんにちは'.length # => 5

Contrast with String#bytesize:

'foo'.bytesize # => 3
'тест'.bytesize # => 8
'こんにちは'.bytesize # => 15

Related: see {Querying}[rdoc-ref:String@Querying].
1 change: 0 additions & 1 deletion doc/string/ljust.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Returns a copy of +self+, left-justified and, if necessary, right-padded with th
'hello'.ljust(10) # => "hello "
' hello'.ljust(10) # => " hello "
'hello'.ljust(10, 'ab') # => "helloababa"
'тест'.ljust(10) # => "тест "
'こんにちは'.ljust(10) # => "こんにちは "

If <tt>width <= self.length</tt>, returns a copy of +self+:
Expand Down
1 change: 0 additions & 1 deletion doc/string/ord.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Returns the integer ordinal of the first character of +self+:

'h'.ord # => 104
'hello'.ord # => 104
'тест'.ord # => 1090
'こんにちは'.ord # => 12371

Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString].
1 change: 0 additions & 1 deletion doc/string/partition.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ then performs the equivalent of <tt>self.index(pattern)</tt>
'hello'.partition('o') # => ["hell", "o", ""]
'hello'.partition('') # => ["", "", "hello"]
'hello'.partition('x') # => ["hello", "", ""]
'тест'.partition('т') # => ["", "т", "ест"]
'こんにちは'.partition('に') # => ["こん", "に", "ちは"]

Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString].
1 change: 0 additions & 1 deletion doc/string/rindex.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ When +pattern+ is a string, returns the index of the last matching substring in
'foo'.rindex('o') # => 2
'foo'.rindex('oo' # => 1
'foo'.rindex('ooo') # => nil
'тест'.rindex('т') # => 3
'こんにちは'.rindex('ち') # => 3

When +pattern+ is a Regexp, returns the index of the last match in self:
Expand Down
1 change: 0 additions & 1 deletion doc/string/rjust.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ right justified and padded on the left with +pad_string+:
'hello'.rjust(10) # => " hello"
'hello '.rjust(10) # => " hello "
'hello'.rjust(10, 'ab') # => "ababahello"
'тест'.rjust(10) # => " тест"
'こんにちは'.rjust(10) # => " こんにちは"

If <tt>width <= self.size</tt>, returns a copy of +self+:
Expand Down
2 changes: 0 additions & 2 deletions doc/string/rpartition.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ If +pattern+ is a Regexp, searches for the last matching substring
'hello'.rpartition(/o/) # => ["hell", "o", ""]
'hello'.rpartition(//) # => ["hello", "", ""]
'hello'.rpartition(/x/) # => ["", "", "hello"]
'тест'.rpartition(/т/) # => ["тес", "т", ""]
'こんにちは'.rpartition(/に/) # => ["こん", "に", "ちは"]

If +pattern+ is not a Regexp, converts it to a string (if it is not already one),
Expand All @@ -43,7 +42,6 @@ then searches for the last matching substring
'hello'.rpartition('h') # => ["", "h", "ello"]
'hello'.rpartition('o') # => ["hell", "o", ""]
'hello'.rpartition('') # => ["hello", "", ""]
'тест'.rpartition('т') # => ["тес", "т", ""]
'こんにちは'.rpartition('に') # => ["こん", "に", "ちは"]

Related: see {Converting to Non-String}[rdoc-ref:String@Converting+to+Non--5CString].
1 change: 0 additions & 1 deletion doc/string/scan.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ With no block given, returns an array of the results:
'cruel world'.scan(/.../) # => ["cru", "el ", "wor"]
'cruel world'.scan(/(...)/) # => [["cru"], ["el "], ["wor"]]
'cruel world'.scan(/(..)(..)/) # => [["cr", "ue"], ["l ", "wo"]]
'тест'.scan(/../) # => ["те", "ст"]
'こんにちは'.scan(/../) # => ["こん", "にち"]
'abracadabra'.scan('ab') # => ["ab", "ab"]
'abracadabra'.scan('nosuch') # => []
Expand Down
Loading