mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Suppor slicing of bytes.
This commit is contained in:
@@ -1,5 +1,14 @@
|
||||
module ct_slice @test;
|
||||
|
||||
fn void! slice_bytes()
|
||||
{
|
||||
char[4] $a = x'aabbccdd';
|
||||
var $b = $a[1..2];
|
||||
char[2] y = $b;
|
||||
assert($b == char[] { 187, 204 });
|
||||
assert(y == char[2] { 187, 204 });
|
||||
}
|
||||
|
||||
fn void! slice_string()
|
||||
{
|
||||
String $a = "abcd";
|
||||
|
||||
Reference in New Issue
Block a user