mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fix #1353 os.get_line
This commit is contained in:
parent
45029f8c86
commit
8484de86c7
11
vlib/os/os.v
11
vlib/os/os.v
@ -509,11 +509,12 @@ pub fn filename(path string) string {
|
||||
// get_line returns a one-line string from stdin
|
||||
pub fn get_line() string {
|
||||
str := get_raw_line()
|
||||
if str[str.len - 1] == `\n` {
|
||||
return str.substr(0, str.len - 1)
|
||||
}
|
||||
|
||||
return str
|
||||
$if windows {
|
||||
return str.trim_right('\r\n')
|
||||
}
|
||||
$else {
|
||||
return str.trim_right('\n')
|
||||
}
|
||||
}
|
||||
|
||||
// get_raw_line returns a one-line string from stdin along with '\n' if there is any
|
||||
|
Loading…
Reference in New Issue
Block a user