Skip to content

Instantly share code, notes, and snippets.

@wfxr
Created November 16, 2017 08:24
Show Gist options
  • Save wfxr/6034cd7af741f6968d6b03d7b1cd8d0e to your computer and use it in GitHub Desktop.
Save wfxr/6034cd7af741f6968d6b03d7b1cd8d0e to your computer and use it in GitHub Desktop.
Zsh代码片段

将字符串分割成数组

str='Tom,Jarry'
users=(${(@s/,/)str})

将数组合并成字符串

# 用回车符Join
${(j:\n:)users}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment