1
0
mirror of https://gitea.com/Sirherobrine23/tea.git synced 2024-07-07 09:15:52 -03:00
tea/modules/utils/parse.go

19 lines
413 B
Go
Raw Normal View History

// Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package utils
import (
"strconv"
"strings"
)
// ArgToIndex take issue/pull index as string and return int64
func ArgToIndex(arg string) (int64, error) {
if strings.HasPrefix(arg, "#") {
arg = arg[1:]
}
return strconv.ParseInt(arg, 10, 64)
}