mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
22 lines
344 B
Go
22 lines
344 B
Go
package utils
|
|
|
|
import (
|
|
"regexp"
|
|
)
|
|
|
|
var trimIndexPattern = regexp.MustCompile(`^\s*(.+?)\s*$`)
|
|
|
|
func GetTrimIndex(s string) []int {
|
|
indexes := trimIndexPattern.FindStringSubmatchIndex(s)
|
|
|
|
if indexes == nil {
|
|
return nil
|
|
}
|
|
|
|
return indexes[2:4]
|
|
}
|
|
|
|
func SplitIntoLines(s string) []string {
|
|
return regexp.MustCompile("\r?\n").Split(s, -1)
|
|
}
|