How to trim leading and trailing white spaces of a string?

后端 未结 7 1351
别那么骄傲
别那么骄傲 2021-01-30 02:56

Which is the effective way to trim the leading and trailing white spaces of string variable in Go?

7条回答
  •  春和景丽
    2021-01-30 03:31

    For trimming your string, Go's "strings" package have TrimSpace(), Trim() function that trims leading and trailing spaces.

    Check the documentation for more information.

提交回复
热议问题