mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 20:04:18 +00:00
Update documentation for parseEnum in strutils.nim (#23804)
added small note regarding style insensitivity for parsing enums. the casing of the first letter is still taken into account for this function. was confused a little at first because when I read "style insensitive manner" I thought it meant casing as well and ran into a couple of `ValueError`'s because of it.
This commit is contained in:
@@ -1307,7 +1307,7 @@ func parseEnum*[T: enum](s: string): T =
|
||||
## type contains multiple fields with the same string value.
|
||||
##
|
||||
## Raises `ValueError` for an invalid value in `s`. The comparison is
|
||||
## done in a style insensitive way.
|
||||
## done in a style insensitive way (first letter is still case-sensitive).
|
||||
runnableExamples:
|
||||
type
|
||||
MyEnum = enum
|
||||
@@ -1327,7 +1327,7 @@ func parseEnum*[T: enum](s: string, default: T): T =
|
||||
## type contains multiple fields with the same string value.
|
||||
##
|
||||
## Uses `default` for an invalid value in `s`. The comparison is done in a
|
||||
## style insensitive way.
|
||||
## style insensitive way (first letter is still case-sensitive).
|
||||
runnableExamples:
|
||||
type
|
||||
MyEnum = enum
|
||||
|
||||
Reference in New Issue
Block a user