Skip to main content

MapStrings

Applies a mapping function to each string in a slice of strings, modifying the slice in place.

def MapStrings(
mapper: func(string) string,
strings: ...string
) - > []string

Applies a given mapping function to each string in a slice of strings, modifying the slice in place. This function is useful for transforming a collection of strings, such as formatting or sanitizing them.

Parameters

NameTypeDescription
mapperfunc(string) stringThe function to apply to each string. It takes a single string as input and returns a transformed string.
strings...stringA variadic slice of strings to be transformed. If the slice is nil, an empty slice is returned.

Returns

TypeDescription
[]stringThe modified slice of strings after applying the mapper function to each element.