15 lines
293 B
Go
15 lines
293 B
Go
|
package strcase
|
||
|
|
||
|
import (
|
||
|
"regexp"
|
||
|
)
|
||
|
|
||
|
var numberSequence = regexp.MustCompile(`([a-zA-Z])(\d+)([a-zA-Z]?)`)
|
||
|
var numberReplacement = []byte(`$1 $2 $3`)
|
||
|
|
||
|
func addWordBoundariesToNumbers(s string) string {
|
||
|
b := []byte(s)
|
||
|
b = numberSequence.ReplaceAll(b, numberReplacement)
|
||
|
return string(b)
|
||
|
}
|