You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
funcmain() {
prefix:=strings.CommonPrefix("nation", "national", "nasty")
fmt.Println(prefix) // Output: na
}
CommonSuffix
funcmain() {
suffix:=strings.CommonSuffix("testing", "running", "jumping")
fmt.Println(suffix) // Output: ing
}
Truncate
funcmain() {
short:=Truncate("This is a long string that needs to be truncated", &TruncateOptions{Length: 20, Omission: "°°°"})
fmt.Println(short) // Output: This is a long strin°°°defaultShort:=Truncate("Short example", nil)
fmt.Println(defaultShort) // Output: Short examp...
}