9

[Golang] Trim Prefix or Suffix from String

 2 years ago
source link: https://siongui.github.io/2016/12/28/go-remove-prefix-or-suffix-from-string/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK