Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changes from Version 1 of AppendingExample/D1

Show
Ignore:
Author:
Andrej08 (IP: 78.2.57.183)
Timestamp:
09/05/10 16:24:25 (14 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AppendingExample/D1

    v0 v1  
     1= Appending = 
     2 
     3''Part of'' TutorialFundamentals 
     4 
     5== Description == 
     6 
     7Shows how appending works with D dynamic strings. 
     8 
     9== Example == 
     10 
     11{{{ 
     12#!d 
     13import std.stdio; 
     14 
     15void main() { 
     16    string s; 
     17    writefln("Length: %d\tString: '%s'", s.length, s); 
     18 
     19    s ~= "something "; 
     20    writefln("Length: %d\tString: '%s'", s.length, s); 
     21 
     22    s ~= "whatever"; 
     23    writefln("Length: %d\tString: '%s'", s.length, s); 
     24} 
     25}}} 
     26 
     27== Output == 
     28{{{ 
     29Length: 0       String: '' 
     30Length: 10      String: 'something ' 
     31Length: 18      String: 'something whatever' 
     32 
     33}}} 
     34 
     35== Source == 
     36 
     37Based on [http://jcc_7.tripod.com/d/tutor/appending.html appending.html] by jcc7.