String - append char
Matesax
matesax at gmail.com
Wed Oct 9 13:47:03 PDT 2013
Hi,
I need to append chars into string in foreach statement.
void main(string[] args)
{
string
result = "",
source = chomp(readText(args[1]));
foreach(int index, char letter; source)
result += letter; //14
writeln(result);
}
But it returning:
main.d:14: Error: 'result' is not a scalar, it is a string
main.d:14: Error: incompatible types for ((result) += (letter)):
'string' and 'char'
I try an pointer, but it damaged a string...
Thank you for help.
More information about the D.gnu
mailing list