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

StringKit.trim方法逻辑有问题 #43

Closed
looly opened this issue Jan 18, 2016 · 1 comment
Closed

StringKit.trim方法逻辑有问题 #43

looly opened this issue Jan 18, 2016 · 1 comment
Labels

Comments

@looly
Copy link

looly commented Jan 18, 2016

private static String trim(String str, String stripChars, int mode)

此方法逻辑有问题

stripChars.indexOf(str.charAt(start)) != -1

此行并不能判定字符串顺序,例如

String a = "abcdefgbac";
System.out.println(trim(a, "abc", 0)); //结果defg

trim方法会匹配abc,同时也会匹配acb、bac、cba等等

@looly looly added the bug label Jan 18, 2016
@hellokaton
Copy link
Member

fix

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

No branches or pull requests

2 participants