Bug 11356 – isASCII for strings

Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-25T12:45:00Z
Last change time
2016-04-11T06:56:31Z
Keywords
pull
Assigned to
nobody
Creator
monarchdodra

Comments

Comment #0 by monarchdodra — 2013-10-25T12:45:55Z
As mentioned in the boards: http://forum.dlang.org/thread/[email protected] This is a request that comes often enough to warrant inclusion in phobos
Comment #1 by andrej.mitrovich — 2014-04-26T19:50:50Z
https://github.com/D-Programming-Language/phobos/pull/1665 I don't know why Walter was so hanged up about this. It's a simple function. I think it's worth reopening and maybe casting a vote in the forums.
Comment #2 by monarchdodra — 2014-06-13T17:27:52Z
(In reply to Andrej Mitrovic from comment #1) > https://github.com/D-Programming-Language/phobos/pull/1665 > > I don't know why Walter was so hanged up about this. It's a simple function. > I think it's worth reopening and maybe casting a vote in the forums. I've been meaning to reply to this for a while, but you know how it is... Anywhoo, one of the issues that stopped me from re-opening it, was defining a useful interface: Returning "simply" a bool is fine and all, but chances are that when the function returns "false", as user wants to know "Ok, there's non-ASCII characters in here. Where are they?". So without making the function more complicated, there are chances it could return more information than "just" yes/no. I'd have suggested that isASCII return a slice that starts at (or roughly before) the first non-ASCII character in the string. This would be useful for input with "little to no unicode". The *issue* with this is that is would "flip" isASCII's return code, "thanks" to implicit slice to bool conversion >:( Or maybe I'm just over-engineering. What's for sure, I don't want to introduce more than 1 function for this...
Comment #3 by bearophile_hugs — 2014-06-13T17:47:31Z
(In reply to monarchdodra from comment #2) > The *issue* with this is that is > would "flip" isASCII's return code, "thanks" to implicit slice to bool > conversion >:( I suggest to kill the implicit array->bool cast.
Comment #4 by jack — 2016-04-05T00:58:23Z
*** Issue 13020 has been marked as a duplicate of this issue. ***
Comment #5 by bugzilla — 2016-04-11T05:24:44Z
Comment #6 by github-bugzilla — 2016-04-11T06:56:31Z
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/0015fd25b70d1bfa83a9c3563760ad85fdfbb9ca Merge pull request #4153 from JackStouffer/issue11356 Add Informative Example to canEncode