-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstrings.go
91 lines (72 loc) · 1.65 KB
/
strings.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package main
import (
"fmt"
"math"
"unicode"
)
// Returns true if given string is a number
func IsStringNumber(_theString string) bool {
isString := true
if len(_theString) > 0 {
for _, currentChar := range _theString {
if !unicode.IsDigit(currentChar) {
isString = false
break
}
}
} else {
isString = false
fmt.Println(fmt.Sprintf(UI_ParameterInvalid, GetFunctionName()), "_theString:", _theString)
}
return isString
}
// Returns true if given string is a help argument
func IsStringHelpArgument(_theString string) bool {
isHelpArgument := false
if len(_theString) > 0 {
switch _theString {
case "?":
isHelpArgument = true
case "/?":
isHelpArgument = true
case "-?":
isHelpArgument = true
case "--?":
isHelpArgument = true
case "h":
isHelpArgument = true
case "/h":
isHelpArgument = true
case "-h":
isHelpArgument = true
case "--h":
isHelpArgument = true
case "help":
isHelpArgument = true
case "/help":
isHelpArgument = true
case "-help":
isHelpArgument = true
case "--help":
isHelpArgument = true
}
} else {
fmt.Println(fmt.Sprintf(UI_ParameterInvalid, GetFunctionName()), "_theString:", _theString)
}
return isHelpArgument
}
// Display section type name
func DisplaySectionType(_sectionType SECTION_TYPE) string {
sectionType := ""
if _sectionType >= 1 && _sectionType <= math.MaxInt16 {
switch _sectionType {
case RANDOM_SPACE:
sectionType = UI_RandomSpace
case OVERWRITE_SECTION:
sectionType = UI_OverwriteSection
}
} else {
fmt.Println(fmt.Sprintf(UI_ParameterInvalid, GetFunctionName()), "_sectionType:", _sectionType)
}
return sectionType
}