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

19、写一个函数,匹配输入字符串里的所有数字部分,数字至多包含两位小数,返回包含所有匹配结果的数组,并去重。 #19

Open
shengq666 opened this issue Jul 27, 2020 · 1 comment

Comments

@shengq666
Copy link
Owner

写一个函数,匹配输入字符串里的所有数字部分,数字至多包含两位小数,返回包含所有匹配结果的数组,并去重。

@shengq666
Copy link
Owner Author

shengq666 commented Jul 27, 2020

function filterStr(str) {
  return [...new Set(str.match(/\d{1,}\.\d{1,2}|\d{1,}/g))]
}

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

1 participant