to delete the '\0' characters

Salih Dincer salihdb at hotmail.com
Thu Sep 22 20:53:28 UTC 2022


On Thursday, 22 September 2022 at 15:22:06 UTC, Ali Çehreli wrote:
> On 9/22/22 08:19, Ali Çehreli wrote:
> > ```d
> > string noZeroes(string s)
> > {
> >      return s.byCodeUnit.filter!(c => c != '\0');
> > }
> > ```
> That won't compile; the return type must be 'auto'.
>
> Ali

Thank you for all the valuable information you wrote. I chose to 
split because the '\0' are at the end of the string:

```d
string splitz(string s)
{
   import std.string : indexOf;
   size_t seekPos = s.indexOf('\0');
   return s[0..seekPos];
}
```

SDB at 79


More information about the Digitalmars-d-learn mailing list