authorgravatar for josh@inv.alid.pwJosh Holland <josh@inv.alid.pw> 2020-12-15 18:41:50+00:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-12-17 19:01:13+02:00
loge93cb2254171f38317f97e685b79dec397f47bb7
tree73d15f477a6f6e71ad90021a79535d21667faf39
parente16997a66cd8eccc5d7bcb819355100b34ce5c44

Improve documentation for string slices.

Closes #7454.

1 files changed, 4 insertions(+), 4 deletions(-)

doc/langref.html.in+4-4
...@@ -2328,10 +2328,10 @@ const mem = std.mem;...@@ -2328,10 +2328,10 @@ const mem = std.mem;
2328const fmt = std.fmt;2328const fmt = std.fmt;
23292329
2330test "using slices for strings" {2330test "using slices for strings" {
2331 // Zig has no concept of strings. String literals are const pointers to2331 // Zig has no concept of strings. String literals are const pointers
2332 // arrays of u8, and by convention parameters that are "strings" are2332 // to null-terminated arrays of u8, and by convention parameters
2333 // expected to be UTF-8 encoded slices of u8.2333 // that are "strings" are expected to be UTF-8 encoded slices of u8.
2334 // Here we coerce [5]u8 to []const u82334 // Here we coerce *const [5:0]u8 and *const [6:0]u8 to []const u8
2335 const hello: []const u8 = "hello";2335 const hello: []const u8 = "hello";
2336 const world: []const u8 = "世界";2336 const world: []const u8 = "世界";
23372337