[Issue 18632] New: enable use of fromStringz with char[n]
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 19 21:45:10 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18632
Issue ID: 18632
Summary: enable use of fromStringz with char[n]
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: elpenguino+D at gmail.com
i.e.
```
char[40] cString;
auto someString = cString.fromStringz();
assert((someString.length >= 0) && (someString.length <= 40));
```
This would behave more like strnlen than strlen, and would be particularly
useful when the maximum size of the string is known ahead of time.
This would possibly also have the benefit of being @safe and pure.
--
More information about the Digitalmars-d-bugs
mailing list