counting characters

celavek via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 19 02:34:11 PDT 2016


Hi,

I am trying to count characters in a string like:

const string dna_chain = 
"AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC";
counts['A'] = countchars!(dna_chain, 'A');

But I get a compilation error:

template instance countchars!(dna_chain, "C") does not match 
template declaration countchars(S, S1)(S s, in S1 pattern) if 
(isSomeString!S && isSomeString!S1)

I cannot figure out why I do get the error. It completely eludes 
me. The documentation of countchars is minimal and it lacks 
examples.
Could someone enlighten me?

dmd version:
DMD64 D Compiler v2.071.1

Thanks


More information about the Digitalmars-d-learn mailing list