Is there s.th. like enforceSuffix for arrays (string)?

Andre Pany via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 22 11:18:22 PDT 2017


Hi,

i often need to check whether an array(string) ends with a 
specific text and if not I need to add this text.

For example I have a variable url and / has to be added to the 
end in case it is missing.

I want to write:
...new RegistryPackageSupplier(URL(url.enforceSuffix("/"))...

Of course the logic is rather simple to implement on my side but 
I often has this requirement and I cannot believe this 
functionality is missing in Phobos.

Have I missed it in the documentation?

Kind regards
André


More information about the Digitalmars-d-learn mailing list