Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

循环中拼接字符串 #182

Copy link
Copy link
@QiAnXinCodeSafe

Description

@QiAnXinCodeSafe
Issue body actions

String s = "";
if (array != null) {
if (split == null) {
split = ",";
}
for (int i = 0; i < array.length; i++) {
if (ignoreEmptyItem && isEmpty(array[i], true)) {
continue;
}
s += ((i > 0 ? split : "") + array[i]);
}
}

String numberString = "";
String single;
for (int i = 0; i < s.length(); i++) {
single = s.substring(i, i + 1);
if (isNumer(single)) {
numberString += single;
} else {
if (onlyStart) {
return numberString;
}
}
}

String correctPrice = "";
String s;
for (int i = 0; i < price.length(); i++) {
s = price.substring(i, i + 1);
if (".".equals(s) || isNumer(s)) {
correctPrice += s;
}
}

建议在循环中使用StringBuilder拼接字符串

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.