Repeat a string: Difference between revisions
Content added Content deleted
(Clarify Scratch a little) |
|||
Line 213: | Line 213: | ||
=={{header|D}}== |
=={{header|D}}== |
||
Repeating a string: |
Repeating a string: |
||
<lang d>import std.stdio; |
<lang d>import std.stdio, std.string; |
||
import std.string; |
|||
void main() |
void main() { |
||
⚫ | |||
{ |
|||
⚫ | |||
}</lang> |
}</lang> |
||
Repeating a character with vector operations: |
Repeating a character with vector operations: |
||
Line 224: | Line 222: | ||
void main() { |
void main() { |
||
char[] |
char[] chars; // create the dynamic array |
||
chars.length = 5; // set the length |
|||
chars[] = '*'; // set all characters in the string to '*' |
|||
writefln( |
writefln(chars); |
||
}</lang> |
}</lang> |
||