How to code Z-Function of string?

Dennis dkorpel at gmail.com
Thu Mar 26 20:08:39 UTC 2020


On Thursday, 26 March 2020 at 19:34:08 UTC, Quantium wrote:
> 1. How can I make string ONLY char[] (Not immutable)

You can use .dup to make a mutable copy of an array.

```
char[] a = "abc".dup;
```

> 2. How can I work with some of chars in the stirng, is, for 
> example:
>     string s="abc";
>     writeln(s[1]); // Should write 'b' or not???
> Is it a legit code or it doesn't work ?

Yes, that works.


More information about the Digitalmars-d-learn mailing list