On Thursday, 22 September 2022 at 13:29:43 UTC, user1234 wrote:
Two remarks:
1. The zero implicitly added to literals is not part of the
string. for example s[$-1] will not give 0 unless you added it
explictly to a literal
2. you code remove all the 0, not the one at the end. As it
still ensure what you want to achieve, maybe try
[`stripRight()`](https://dlang.org/phobos/std_string.html#.stripRight). The second overload allows to specify the characters to remove.
As I mentioned earlier stripRight() and others don't work. What
I'm talking about is not the terminating character. Actually, I'm
the one who added the \0 character, and they are multiple. For
example:
4B 6F 72 6B 6D 61 20 73 F6 6E 6D 65 7A 20 62 75 20 15F 61 66 61
6B 6C 61 72 64 61 20 79 FC 7A 65 6E 20 61 6C 20 73 61 6E 63 61
6B 0 0
53 F6 6E 6D 65 64 65 6E 20 79 75 72 64 75 6D 75 6E 20 FC 73 74 FC
6E 64 65 20 74 FC 74 65 6E 20 65 6E 20 73 6F 6E 20 6F 63 61 6B 0
4F 20 62 65 6E 69 6D 20 6D 69 6C 6C 65 74 69 6D 69 6E 20 79 131
6C 64 131 7A 131 64 131 72 20 70 61 72 6C 61 79 61 63 61 6B 0 0 0
0
4F 20 62 65 6E 69 6D 64 69 72 20 6F 20 62 65 6E 69 6D 20 6D 69 6C
6C 65 74 69 6D 69 6E 64 69 72 20 61 6E 63 61 6B 0 0
C7 61 74 6D 61 20 6B 75 72 62 61 6E 20 6F 6C 61 79 131 6D 20 E7
65 68 72 65 6E 69 20 65 79 20 6E 61 7A 6C 131 20 68 69 6C 61 6C 0
0
4B 61 68 72 61 6D 61 6E 20 131 72 6B 131 6D 61 20 62 69 72 20 67
FC 6C 20 6E 65 20 62 75 20 15F 69 64 64 65 74 20 62 75 20 63 65
6C E2 6C 0 0 0 0 0 0
Thanks, SDB@79