Commit 6739b8d6 authored by Rob Pike's avatar Rob Pike

string([]int) is now implemented

R=rsc
DELTA=18  (10 added, 2 deleted, 6 changed)
OCL=29909
CL=29909
parent 2f2577a4
...@@ -4388,8 +4388,6 @@ Implementation does not honor the restriction on goto statements and targets (no ...@@ -4388,8 +4388,6 @@ Implementation does not honor the restriction on goto statements and targets (no
cap() does not work on maps or chans. cap() does not work on maps or chans.
<br/> <br/>
len() does not work on chans. len() does not work on chans.
<br>
string([]int{...}) conversion is not yet implemented.
</font> </font>
</p> </p>
......
...@@ -88,15 +88,25 @@ main() ...@@ -88,15 +88,25 @@ main()
z1[2] = 'c'; z1[2] = 'c';
c = string(&z1); c = string(&z1);
if c != "abc" { if c != "abc" {
panic("create array ", c); panic("create byte array ", c);
} }
/* create string with byte array pointer */ /* create string with int array */
z2 := new([3]byte); var z2 [3]int;
z2[0] = 'a'; z2[0] = 'a';
z2[1] = 'b'; z2[1] = '\u1234';
z2[2] = 'c'; z2[2] = 'c';
c = string(z2); c = string(&z2);
if c != "a\u1234c" {
panic("create int array ", c);
}
/* create string with byte array pointer */
z3 := new([3]byte);
z3[0] = 'a';
z3[1] = 'b';
z3[2] = 'c';
c = string(z3);
if c != "abc" { if c != "abc" {
panic("create array pointer ", c); panic("create array pointer ", c);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment