string manipulation performance

Lloyd Dupont ld-REMOVE at galador.net
Sun Jun 12 09:49:25 PDT 2011


I have a method like that:
===
public string repeat(string s, int num)
{
    string result = s;
    for (int  i=1; i<num; i++)
        result ~= s;
    return result;
}
===
basically it will create num string, each a little longer...
is there a more efficient way to go about that?
thanks! :)



More information about the Digitalmars-d-learn mailing list