@@ -20,7 +20,7 @@ type Address struct {
20
20
func (a * Address ) FormattedParts () []string {
21
21
rule , found := formatRules [strings .ToUpper (a .Country )]
22
22
if ! found {
23
- rule , _ = formatRules ["DE" ]
23
+ rule = formatRules ["DE" ]
24
24
}
25
25
return a .formatWithRule (rule )
26
26
}
@@ -36,14 +36,14 @@ func (a *Address) formatWithRule(r []string) []string {
36
36
s = strings .Replace (s , "{PostalCode}" , a .PostalCode , - 1 )
37
37
s = strings .Replace (s , "{Locality}" , a .Locality , - 1 )
38
38
s = strings .Replace (s , "{Region}" , a .Region , - 1 )
39
- if strings .Index (s , "{-Region}" ) >= 0 {
39
+ if strings .Contains (s , "{-Region}" ) {
40
40
if a .Region != "" {
41
41
s = strings .Replace (s , "{-Region}" , "-" + a .Region , - 1 )
42
42
} else {
43
43
s = strings .Replace (s , "{-Region}" , "" , - 1 )
44
44
}
45
45
}
46
- if strings .Index (s , "{, Region}" ) >= 0 {
46
+ if strings .Contains (s , "{, Region}" ) {
47
47
if a .Region != "" {
48
48
s = strings .Replace (s , "{, Region}" , ", " + a .Region , - 1 )
49
49
} else {
0 commit comments