added string appending D example
git-svn-id: svn://anubis/misc/d@90 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
1 parent
1a913f52c2
commit
f29d300775
2 files changed
+29
No files matched your search
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
TARGET := appending
|
||||||
|
|
||||||
|
all: $(TARGET)
|
||||||
|
|
||||||
|
$(TARGET): $(TARGET).d
|
||||||
|
|
||||||
|
%: %.d
|
||||||
|
gdc -o $@ $<
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-rm -f *.o *~ $(TARGET)
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
Reference in new issue
Block a user