added string appending D example
git-svn-id: svn://anubis/misc/d@90 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
parent
1a913f52c2
commit
f29d300775
12
appending/Makefile
Normal file
12
appending/Makefile
Normal 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
17
appending/appending.d
Normal 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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user