Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2 slice包希望提供JoinFunc #260

Open
eren1017 opened this issue Oct 22, 2024 · 3 comments
Open

v2 slice包希望提供JoinFunc #260

eren1017 opened this issue Oct 22, 2024 · 3 comments

Comments

@eren1017
Copy link

针对某些复杂结构的切片, 希望可以定制返回的字符串, 而不是把整个结构都转换为string

@duke-git
Copy link
Owner

针对某些复杂结构的切片, 希望可以定制返回的字符串, 而不是把整个结构都转换为string

下个版本可以提供JoinFunc相关函数,可以讨论下面哪个函数更合适通用:

func JoinFunc[T any](slice []T, sep T, transform func(T) T) T

func JoinFunc[T any](slice []T, sep T, connector func(T, T) T) T

@eren1017
Copy link
Author

针对某些复杂结构的切片, 希望可以定制返回的字符串, 而不是把整个结构都转换为string

下个版本可以提供JoinFunc相关函数,可以讨论下面哪个函数更合适通用:

func JoinFunc[T any](slice []T, sep T, transform func(T) T) T

func JoinFunc[T any](slice []T, sep T, connector func(T, T) T) T

更偏向于

func JoinFunc[T any](slice []T, sep string, transform func(T) any) string

@duke-git
Copy link
Owner

@eren1017 rc分支添加了JoinFuncConcatBy,下个版本会发布。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants