Revert "add fromChar" (#20336)
Revert "add `fromChar` (#20332)"
This reverts commit 846cc746a2.
This commit is contained in:
parent
6bf21e7b3d
commit
c9a92117f9
1 changed files with 0 additions and 9 deletions
|
|
@ -997,15 +997,6 @@ func toOctal*(c: char): string {.rtl, extern: "nsuToOctal".} =
|
||||||
result[i] = chr(val mod 8 + ord('0'))
|
result[i] = chr(val mod 8 + ord('0'))
|
||||||
val = val div 8
|
val = val div 8
|
||||||
|
|
||||||
func fromChar[T: SomeInteger](ch: char): T =
|
|
||||||
runnableExamples:
|
|
||||||
assert fromChar[int8]('6') == 6
|
|
||||||
doAssertRaises AssertionDefect:
|
|
||||||
fromChar[int8]('a')
|
|
||||||
|
|
||||||
assert isDigit(ch)
|
|
||||||
T(ord(ch) - ord('0'))
|
|
||||||
|
|
||||||
func fromBin*[T: SomeInteger](s: string): T =
|
func fromBin*[T: SomeInteger](s: string): T =
|
||||||
## Parses a binary integer value from a string `s`.
|
## Parses a binary integer value from a string `s`.
|
||||||
##
|
##
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue