[Golang] Trim Prefix or Suffix from String
Trim/Remove Prefix
Q: How to trim leading samma from sammadiṭṭhi?
A: Use TrimPrefix function in strings package
result := strings.TrimPrefix("sammadiṭṭhi", "samma")See here for official example of TrimPrefix.
Trim/Remove Suffix
Q: How to trim trailing diṭṭhi from sammadiṭṭhi?
A: Use TrimSuffix function in strings package
result := strings.TrimSuffix("sammadiṭṭhi", "diṭṭhi")See here for official example of TrimSuffix.
Tested on: Ubuntu Linux 16.10, Go 1.7.4.
References:
[1] |
[2] |
[3] |