c5f6a28448
In addition, the Access-Control-Allow-Origin header is set to the same URL if an Origin header is found in the request (experimental). Signed-off-by: Michael Mayer <michael@photoprism.app>
18 lines
285 B
Go
18 lines
285 B
Go
package clean
|
|
|
|
// ASCII removes all non-ascii characters from a string and returns it.
|
|
func ASCII(s string) string {
|
|
if s == "" {
|
|
return ""
|
|
}
|
|
|
|
result := make([]rune, 0, len(s))
|
|
|
|
for _, r := range s {
|
|
if r <= 127 {
|
|
result = append(result, r)
|
|
}
|
|
}
|
|
|
|
return string(result)
|
|
}
|