On Thursday, 22 September 2022 at 20:53:28 UTC, Salih Dincer
wrote:
```d
string splitz(string s)
{
import std.string : indexOf;
size_t seekPos = s.indexOf('\0');
return s[0..seekPos];
}
```
I ignored the possibility of not finding '\0'. I'm fixing it now:
```d
string splitz(string s)
{
import std.string : indexOf;
auto seekPos = s.indexOf('\0');
return seekPos > 0 ? s[0..seekPos] : s;
}
```
But I also wish it could be like this:
```d
string splitz(string s)
{
import std.string : indexOf;
if(auto seekPos = s.indexOf('\0') > 0)
{
return s[0..seekPos];
}
return s;
}
```
SDB@79