MCPcopy Create free account
hub / github.com/gobeam/stringy / RemoveSpecialCharacter

Method RemoveSpecialCharacter

stringy.go:269–282  ·  view source on GitHub ↗

RemoveSpecialCharacter removes all special characters and returns the string it can be chained on function which return StringManipulation interface

()

Source from the content-addressed store, hash-verified

267// RemoveSpecialCharacter removes all special characters and returns the string
268// it can be chained on function which return StringManipulation interface
269func (i *input) RemoveSpecialCharacter() string {
270 input := getInput(*i)
271 var result strings.Builder
272 for i := 0; i < len(input); i++ {
273 b := input[i]
274 if ('a' <= b && b <= 'z') ||
275 ('A' <= b && b <= 'Z') ||
276 ('0' <= b && b <= '9') ||
277 b == ' ' {
278 result.WriteByte(b)
279 }
280 }
281 return result.String()
282}
283
284// ReplaceFirst takes two param search and replace. It returns string by searching search
285// sub string and replacing it with replace substring on first occurrence it can be chained

Callers

nothing calls this directly

Calls 1

getInputFunction · 0.85

Tested by

no test coverage detected