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

括号内的空格或者其他分隔字符忽略 #1676

Merged
merged 12 commits into from
Oct 29, 2024
Merged

Conversation

wenwenhua
Copy link
Collaborator

No description provided.

stack.push(i)
} else if (str[i] === ')') {
stack.pop()
i + 1 === str.length && (result.push(str.slice(lastIdx, str.length)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

push的条件不应该是结束而是stack清空,以及可以用个数值表示,不用建立一个stack数组

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以及可以同时实现item.trim()

stack--
}
// 非分隔字符添加 括号内的非空分隔字符添加 // Todo 清除括号内的空格 || (stack !== 0 && str[i] === ' ')
if (str[i] !== char || (str[i] === char && stack !== 0 && char !== ' ')) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

条件改为stack!==0 || (str[i] !== char && str[i] !== ' ')

@hiyuki hiyuki merged commit 26baa91 into master Oct 29, 2024
6 checks passed
@hiyuki hiyuki deleted the fix-format-var-241025 branch October 29, 2024 10:54
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

Successfully merging this pull request may close these issues.

2 participants