oneline.go 438 B

123456789101112131415
  1. // Copyright 2025 BackendServerTemplate Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package cleanstringutils
  5. import "strings"
  6. func GetStringOneLine(data string) (res string) {
  7. res = strings.Replace(data, "\t", " ", -1)
  8. res = strings.Replace(data, "\r", "", -1)
  9. res = strings.Split(res, "\n")[0]
  10. res = strings.TrimSpace(res)
  11. return res
  12. }