I want to remove the very last character of a string, but before I do so I want to check if the last character is a "+". How can this be done?
相关问题
- how to split a list into a given number of sub-lis
- Generate string from integer with arbitrary base i
- Golang mongodb aggregation
- Converting a string array to a byte array
- How to flatten out a nested json structure in go
相关文章
- Can I run a single test in a suite?
- JSP String formatting Truncate
- Selecting only the first few characters in a strin
- How to check if a request was cancelled
- Is it possible to implement an interface with unex
- Python: print in two columns
- How to access value of first index of array in Go
- extending c++ string member functions
Builtin function is available now. http://golang.org/pkg/strings/#TrimSuffix
No builtin way. But it's trivial to do manually.
Based on the answer of @KarthikGR the following example was added:
https://play.golang.org/p/ekDeT02ZXoq
returns:
Here are several ways to remove trailing plus sign(s).
Output: