converting to/from char[]/string

mark mark at qtrac.eu
Thu Mar 5 13:52:27 UTC 2020


On Thursday, 5 March 2020 at 13:31:14 UTC, Adam D. Ruppe wrote:
> On Thursday, 5 March 2020 at 11:03:30 UTC, mark wrote:
>> I want to use the Porter stemming algorithm.
>> There's a D implementation here: 
>> https://tartarus.org/martin/PorterStemmer/d.txt
>
> I think I (or ketmar and I stole it from him) ported that very 
> same file before:
>
> https://github.com/adamdruppe/adrdox/blob/master/stemmer.d
>
> By just adding `const` where appropriate it becomes compatible 
> with string and you can slice to take care of the size thing.
>
> https://github.com/adamdruppe/adrdox/blob/master/stemmer.d#L512
>
> is that stem function as a const slice

I thought the problem was using char[] rather than dchar[], but 
evidently not.

I downloaded yours and it "just works": I didn't have to change 
anything. (dscanner gives a couple of const/immutable hints which 
I'll fix, but still.)

Might be good to ask to add yours to 
https://tartarus.org/martin/PorterStemmer/ since it works and the 
old one doesn't.

Thank you!


More information about the Digitalmars-d-learn mailing list