1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2024-11-10 18:00:05 -05:00
moneygo/internal/handlers/util.go

24 lines
501 B
Go
Raw Normal View History

package handlers
2015-06-25 22:36:58 -04:00
import (
"fmt"
"net/http"
"strconv"
"strings"
)
func GetURLID(url string) (int64, error) {
pieces := strings.Split(strings.Trim(url, "/"), "/")
return strconv.ParseInt(pieces[len(pieces)-1], 10, 0)
}
func GetURLPieces(url string, format string, a ...interface{}) (int, error) {
url = strings.Replace(url, "/", " ", -1)
format = strings.Replace(format, "/", " ", -1)
return fmt.Sscanf(url, format, a...)
}
2015-06-25 22:36:58 -04:00
func WriteSuccess(w http.ResponseWriter) {
fmt.Fprint(w, "{}")
}