mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
string: make index() return ?int instead of int/-1
This commit is contained in:
@@ -313,8 +313,7 @@ pub fn (t Time) clean12() string {
|
||||
// `parse` parses time in the following format: "2018-01-27 12:48:34"
|
||||
pub fn parse(s string) Time {
|
||||
// println('parse="$s"')
|
||||
pos := s.index(' ')
|
||||
if pos <= 0 {
|
||||
pos := s.index(' ') or {
|
||||
println('bad time format')
|
||||
return now()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user