update code for tipe surkon

This commit is contained in:
2024-11-05 08:26:58 +07:00
parent 2adf083e9f
commit 1a13a35fbb
8 changed files with 287 additions and 53 deletions

No files matched your search

+16
View File
@@ -1,7 +1,9 @@
package utils
import (
"fmt"
"log"
"strconv"
"strings"
)
@@ -43,3 +45,17 @@ func ReplaceGelar(gelar string) string {
gelar = strings.ReplaceAll(gelar, ",", " ")
return gelar
}
func GetNoUrut(noSurKon string) (string, error) {
noSurKonSlice := strings.Split(noSurKon, "/")
noUrut := noSurKonSlice[3]
noUrutInt, err := strconv.Atoi(noUrut)
if err != nil {
return "", err
}
noUrutInt++
noUrutStr := fmt.Sprintf("%03d", noUrutInt)
log.Println("No Urut: ", noUrutStr)
return noUrutStr, nil
}