generated from VLADIMIR/template
add format string
This commit is contained in:
@@ -2,4 +2,5 @@ package formatter
|
||||
|
||||
type IFormatter interface {
|
||||
FormatText(text string) string
|
||||
FormatString(text string) string
|
||||
}
|
||||
|
||||
@@ -40,3 +40,11 @@ func (s *service) FormatText(text string) string {
|
||||
}
|
||||
return res.String()
|
||||
}
|
||||
|
||||
func (s *service) FormatString(text string) string {
|
||||
l := strings.TrimSpace(text)
|
||||
if strings.HasPrefix(l, "--") {
|
||||
l = strings.Replace(l, "--", "—", 1)
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user