mirror of https://github.com/gobeam/stringy.git
parent
82896f05d5
commit
b4c25dec91
|
@ -10,6 +10,8 @@ import (
|
||||||
"unicode"
|
"unicode"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var matchWordRegexp = regexp.MustCompile(`[\s]*[\W]\pN`)
|
||||||
|
|
||||||
// input is struct that holds input from user and result
|
// input is struct that holds input from user and result
|
||||||
type input struct {
|
type input struct {
|
||||||
Input string
|
Input string
|
||||||
|
@ -228,9 +230,8 @@ func (i *input) LcFirst() string {
|
||||||
|
|
||||||
// Lines returns slice of strings by removing white space characters
|
// Lines returns slice of strings by removing white space characters
|
||||||
func (i *input) Lines() []string {
|
func (i *input) Lines() []string {
|
||||||
input := getInput(*i)
|
input := getInput(*i)
|
||||||
matchWord := regexp.MustCompile(`[\s]*[\W]\pN`)
|
result := matchWordRegexp.ReplaceAllString(input, " ")
|
||||||
result := matchWord.ReplaceAllString(input, " ")
|
|
||||||
return strings.Fields(strings.TrimSpace(result))
|
return strings.Fields(strings.TrimSpace(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue