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
6 changes: 3 additions & 3 deletions bignum.c
Original file line number Diff line number Diff line change
Expand Up @@ -4515,7 +4515,7 @@ rb_str2big_gmp(VALUE arg, int base, int badcheck)

#if HAVE_LONG_LONG

static VALUE
VALUE
rb_ull2big(unsigned LONG_LONG n)
{
long i;
Expand All @@ -4537,7 +4537,7 @@ rb_ull2big(unsigned LONG_LONG n)
return big;
}

static VALUE
VALUE
rb_ll2big(LONG_LONG n)
{
long neg = 0;
Expand Down Expand Up @@ -4575,7 +4575,7 @@ rb_ll2inum(LONG_LONG n)
#endif /* HAVE_LONG_LONG */

#ifdef HAVE_INT128_T
static VALUE
VALUE
rb_uint128t2big(uint128_t n)
{
long i;
Expand Down
41 changes: 27 additions & 14 deletions doc/language/globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ No \English.
### `$/` (Input Record Separator)

An input record separator, initially newline.
Set by the command-line option `-0`.
Set by the [command-line option `-0`].

Setting to non-nil value by other than the command-line option is
deprecated.
Expand All @@ -188,7 +188,9 @@ Aliased as `$-0`.
### `$\` (Output Record Separator)

An output record separator, initially `nil`.
Copied from `$/` when the command-line option `-l` is given.

Copied from `$/` when the [command-line option `-l`] is
given.

Setting to non-nil value by other than the command-line option is
deprecated.
Expand Down Expand Up @@ -328,8 +330,8 @@ The value returned by method ARGF.filename.

### `$DEBUG`

Initially `true` if command-line option `-d` or `--debug` is given,
otherwise initially `false`;
Initially `true` if [command-line option `-d`] or
[`--debug`][command-line option `-d`] is given, otherwise initially `false`;
may be set to either value in the running program.

When `true`, prints each raised exception to `$stderr`.
Expand All @@ -338,8 +340,8 @@ Aliased as `$-d`.

### `$VERBOSE`

Initially `true` if command-line option `-v` or `-w` is given,
otherwise initially `false`;
Initially `true` if [command-line option `-v`] or
[`-w`][command-line option `-w`] is given, otherwise initially `false`;
may be set to either value, or to `nil`, in the running program.

When `true`, enables Ruby warnings.
Expand All @@ -353,7 +355,7 @@ Aliased as `$-v` and `$-w`.
### `$-F`

The default field separator in String#split; must be a String or a
Regexp, and can be set with command-line option `-F`.
Regexp, and can be set with [command-line option `-F`].

Setting to non-nil value by other than the command-line option is
deprecated.
Expand All @@ -362,28 +364,28 @@ Aliased as `$;`.

### `$-a`

Whether command-line option `-a` was given; read-only.
Whether [command-line option `-a`] was given; read-only.

### `$-i`

Contains the extension given with command-line option `-i`,
Contains the extension given with [command-line option `-i`],
or `nil` if none.

An alias of ARGF.inplace_mode.

### `$-l`

Whether command-line option `-l` was set; read-only.
Whether [command-line option `-l`] was set; read-only.

### `$-p`

Whether command-line option `-p` was given; read-only.
Whether [command-line option `-p`] was given; read-only.

### `$F`

If the command line option `-a` is given, the array obtained by
splitting `$_` by `$-F` is assigned at the start of each `-l`/`-p`
loop.
If the [command-line option `-a`] is given, the array
obtained by splitting `$_` by `$-F` is assigned at the start of each
`-l`/`-p` loop.

## Deprecated

Expand Down Expand Up @@ -594,3 +596,14 @@ Output:
"Bar\n"
"Baz\n"
```


[command-line option `-0`]: rdoc-ref:language/options.md@0-3A+Set+-24-2F+-28Input+Record+Separator-29
[command-line option `-F`]: rdoc-ref:language/options.md@F-3A+Set+Input+Field+Separator
[command-line option `-a`]: rdoc-ref:language/options.md@a-3A+Split+Input+Lines+into+Fields
[command-line option `-d`]: rdoc-ref:language/options.md@d-3A+Set+-24DEBUG+to+true
[command-line option `-i`]: rdoc-ref:language/options.md@i-3A+Set+ARGF+In-Place+Mode
[command-line option `-l`]: rdoc-ref:language/options.md@l-3A+Set+Output+Record+Separator-3B+Chop+Lines
[command-line option `-p`]: rdoc-ref:language/options.md@p-3A+-n-2C+with+Printing
[command-line option `-v`]: rdoc-ref:language/options.md@v-3A+Print+Version-3B+Set+-24VERBOSE
[command-line option `-w`]: rdoc-ref:language/options.md@w-3A+Synonym+for+-W1
4 changes: 2 additions & 2 deletions doc/string/aref.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ returns the 1-character substring found in self at character offset index:
'hello'[0] # => "h"
'hello'[4] # => "o"
'hello'[5] # => nil
'тест'[2] # => "с"
'Привет'[2] # => "и"
'こんにちは'[4] # => "は"

With negative integer argument +index+ given,
Expand Down Expand Up @@ -92,7 +92,7 @@ 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].
28 changes: 28 additions & 0 deletions doc/string/capitalize.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Returns a string containing the characters in +self+,
each with possibly changed case:

- The first character made uppercase.
- All other characters are made lowercase.

Examples:

'hello'.capitalize # => "Hello"
'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]:

s = '1, 2, 3, ...'
s.capitalize == s # => true
s = 'こんにちは'
s.capitalize == s # => true

The casing is affected by the given +mapping+,
which may be +:ascii+, +:fold+, or +:turkic+;
see {Case Mappings}[rdoc-ref:case_mapping.rdoc@Case+Mappings].

Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].
20 changes: 14 additions & 6 deletions doc/string/downcase.rdoc
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
Returns a new string containing the downcased characters in +self+:

'Hello, World!'.downcase # => "hello, world!"
'ТЕСТ'.downcase # => "тест"
'よろしくお願いします'.downcase # => "よろしくお願いします"
'HELLO'.downcase # => "hello"
'STRAẞE'.downcase # => "straße"
'ПРИВЕТ'.downcase # => "привет"
'RubyGems.org'.downcase # => "rubygems.org"

Some characters do not have upcased and downcased versions.
Some characters (and some character sets) do not have upcase and downcase versions;
see {Case Mapping}[rdoc-ref:case_mapping.rdoc]:

The casing may be affected by the given +mapping+;
see {Case Mapping}[rdoc-ref:case_mapping.rdoc].
s = '1, 2, 3, ...'
s.downcase == s # => true
s = 'こんにちは'
s.downcase == s # => true

The casing is affected by the given +mapping+,
which may be +:ascii+, +:fold+, or +:turkic+;
see {Case Mappings}[rdoc-ref:case_mapping.rdoc@Case+Mappings].

Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].
27 changes: 20 additions & 7 deletions doc/string/swapcase.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,28 @@ Returns a string containing the characters in +self+, with cases reversed:

Examples:

'Hello World!'.swapcase # => "hELLO wORLD!"
'тест'.swapcase # => "ТЕСТ"
'Hello'.swapcase # => "hELLO"
'Straße'.swapcase # => "sTRASSE"
'Привет'.swapcase # => "пРИВЕТ"
'RubyGems.org'.swapcase # => "rUBYgEMS.ORG"

Some characters (and even character sets) do not have casing:
The sizes of +self+ and the upcased result may differ:

'12345'.swapcase # => "12345"
'こんにちは'.swapcase # => "こんにちは"
s = 'Straße'
s.size # => 6
s.swapcase # => "sTRASSE"
s.swapcase.size # => 7

The casing may be affected by the given +mapping+;
see {Case Mapping}[rdoc-ref:case_mapping.rdoc].
Some characters (and some character sets) do not have upcase and downcase versions;
see {Case Mapping}[rdoc-ref:case_mapping.rdoc]:

s = '1, 2, 3, ...'
s.swapcase == s # => true
s = 'こんにちは'
s.swapcase == s # => true

The casing is affected by the given +mapping+,
which may be +:ascii+, +:fold+, or +:turkic+;
see {Case Mappings}[rdoc-ref:case_mapping.rdoc@Case+Mappings].

Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].
17 changes: 12 additions & 5 deletions doc/string/upcase.rdoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Returns a new string containing the upcased characters in +self+:

'Hello, World!'.upcase # => "HELLO, WORLD!"
'hello'.upcase # => "HELLO"
'straße'.upcase # => "STRASSE"
'привет'.upcase # => "ПРИВЕТ"
'RubyGems.org'.upcase # => "RUBYGEMS.ORG"

The sizes of +self+ and the upcased result may differ:

Expand All @@ -9,12 +12,16 @@ The sizes of +self+ and the upcased result may differ:
s.upcase # => "STRASSE"
s.upcase.size # => 7

Some characters (and some character sets) do not have upcased and downcased versions:
Some characters (and some character sets) do not have upcase and downcase versions;
see {Case Mapping}[rdoc-ref:case_mapping.rdoc]:

s = 'よろしくお願いします'
s = '1, 2, 3, ...'
s.upcase == s # => true
s = 'こんにちは'
s.upcase == s # => true

The casing may be affected by the given +mapping+;
see {Case Mapping}[rdoc-ref:case_mapping.rdoc].
The casing is affected by the given +mapping+,
which may be +:ascii+, +:fold+, or +:turkic+;
see {Case Mappings}[rdoc-ref:case_mapping.rdoc@Case+Mappings].

Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].
Loading