added string appending D example

git-svn-id: svn://anubis/misc/d@90 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
josh 2009-02-14 20:27:59 +00:00
parent 1a913f52c2
commit f29d300775
2 changed files with 29 additions and 0 deletions

12
appending/Makefile Normal file
View File

@ -0,0 +1,12 @@
TARGET := appending
all: $(TARGET)
$(TARGET): $(TARGET).d
%: %.d
gdc -o $@ $<
clean:
-rm -f *.o *~ $(TARGET)

17
appending/appending.d Normal file
View File

@ -0,0 +1,17 @@
import std.stdio;
void main()
{
char[] s;
writefln("Length: %d\tString: '%s', &s: 0x%x",
s.length, s, &s);
s ~= "something ";
writefln("Length: %d\tString: '%s', &s: 0x%x",
s.length, s, &s);
s ~= "whatever";
writefln("Length: %d\tString: '%s', &s: 0x%x",
s.length, s, &s);
}