Skip to content

Commit de680fb

Browse files
author
Ary Borenszweig
committedNov 22, 2016
Added old Char#digit? and Char#alpha? with a deprecation warning, to ease migration. Updated Changelog.
1 parent b6e4744 commit de680fb

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
 

Diff for: ‎CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
* **(breaking change)** Removed `ifdef` from the language
44
* **(breaking change)** Removed `PointerIO`
55
* **(breaking change)** The `body` property of `HTTP::Request` is now an `IO?` (previously it was `String`). Use `request.body.try(&.gets_to_end)` if you need the entire body as a String.
6+
* **(breaking change)** `Char#digit?` was split into `Char#ascii_number?` and `Char#number?`. The old name is still available and will produce a compile-time warning, but will be removed immediately after 0.20.0.
7+
* **(breaking change)** `Char#alpha?` was split into `Char#ascii_letter?` and `Char#letter?`. The old name is still available and will produce a compile-time warning, but will be removed immediately after 0.20.0.
68
* **(breaking change)** The `Iterable` module is now generic
9+
* Many `String` and `Char` methods are now unicode-aware, for example `String#downcase`, `String#upcase`, `Char#downcase`, `Char#upcase`, `Char#whitespace?`, etc.
710
* Added support for HTTP client and server streaming.
811
* Added support for ARM (thanks @ysbaddaden)
912
* Added support for AArch64 (thanks @ysbaddaden)

Diff for: ‎src/char.cr

+12
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ struct Char
124124
ord < 128
125125
end
126126

127+
# DEPRECATED: use `#ascii_number?` or `#number?`. This method will be removed after 0.20.0.
128+
def digit?(base : Int = 10)
129+
{{ puts "Warning: `Char#digit?` is deprecated and will be removed after 0.20.0, use `Char#ascii_number?` or `Char#number?` instead".id }}
130+
ascii_number?(base)
131+
end
132+
127133
# Returns `true` if this char is an ASCII number in specified base.
128134
#
129135
# Base can be from 0 to 36 with digits from '0' to '9' and 'a' to 'z' or 'A' to 'Z'.
@@ -195,6 +201,12 @@ struct Char
195201
ascii? ? ascii_uppercase? : Unicode.uppercase?(self)
196202
end
197203

204+
# DEPRECATED: use `#ascii_letter?` or `#letter?`. This method will be removed after 0.20.0.
205+
def alpha?
206+
{{ puts "Warning: `Char#alpha?` is deprecated and will be removed after 0.20.0, use `Char#ascii_letter?` or `Char#letter?` instead".id }}
207+
ascii_letter?
208+
end
209+
198210
# Returns `true` if this char is an ASCII letter ('a' to 'z', 'A' to 'Z').
199211
#
200212
# ```

0 commit comments

Comments
 (0)
Please sign in to comment.