Added direction notes

This commit is contained in:
2022-09-17 06:42:49 +08:00
parent 7fd8d4fb6a
commit b251e35be4
5 changed files with 44 additions and 4 deletions

View File

@@ -9,4 +9,8 @@ var WORKDIR string = TryGetEnv( "GOLIFEHK_WORKDIR", filepath.Join( os.TempDir(),
var BOM string = bytes.NewBuffer([]byte{ 0xEF, 0xBB, 0xBF }).String()
const KEY_CHARS string = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-"
var POWER_NUMBERS map[string] string = map[string] string {
"0": "⁰", "1": "¹", "2": "²", "3": "³",
"4": "⁴", "5": "⁵", "6": "⁶", "7": "⁷",
"8": "⁸", "9": "⁹",
}

View File

@@ -16,6 +16,13 @@ func WriteMDv2Text( sb *strings.Builder, t string ) {
sb.WriteString( t )
}
func ToPower( t string ) string {
for s, r := range POWER_NUMBERS {
t = strings.ReplaceAll( t, s, r )
}
return t
}
func TryGetEnv[T any]( name string, fallback T ) T {
v := os.Getenv( name )