Skip to content
This repository has been archived by the owner on Aug 24, 2024. It is now read-only.

Commit

Permalink
Update 09-coding-in-zig.md
Browse files Browse the repository at this point in the history
format code
  • Loading branch information
cy-arctique authored Oct 16, 2023
1 parent 0ca40d0 commit e69c601
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions 09-coding-in-zig.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ pub fn main() !void {
var name: []const u8 = line;
// Windows平台换行以`\r\n`结束
// 所以需要截取\r以获取控制台输入字符
if (builtin.os.tag == .windows) {
name = std.mem.trimRight(u8, line[0 .. line.len - 1], "\r");
}
if (builtin.os.tag == .windows) {
name = std.mem.trimRight(u8, line[0 .. line.len - 1], "\r");
}
if (name.len == 0) {
break;
Expand Down Expand Up @@ -251,9 +251,9 @@ pub fn main() !void {
try stdout.print("Please enter a name: ", .{});
if (try stdin.readUntilDelimiterOrEof(&buf, '\n')) |line| {
var name: []const u8 = line;
if (builtin.os.tag == .windows) {
name = std.mem.trimRight(u8, line[0 .. line.len - 1], "\r");
}
if (builtin.os.tag == .windows) {
name = std.mem.trimRight(u8, line[0 .. line.len - 1], "\r");
}
if (name.len == 0) {
break;
Expand Down

0 comments on commit e69c601

Please sign in to comment.