表題のライブラリーを読解しております。
★マークの部分がローカル変数の重複宣言になってしまっていると
思っているのですが、このような記述は可能なのでしょうか?
■ライブラリ
commons-lang3-3.4.jar
■対象ソース
StringUtil.class
Java
1 public static String stripEnd(String str, String stripChars) { 2 int end; //★ココ 3 if ((str == null) || ((end = str.length()) == 0)) { 4 return str; 5 } 6 int end; //★ココ 7 if (stripChars == null) { 8 while ((end != 0) && (Character.isWhitespace(str.charAt(end - 1)))) { 9 end--; 10 } 11 } 12 if (stripChars.isEmpty()) { 13 return str; 14 } 15 while ((end != 0) && (stripChars.indexOf(str.charAt(end - 1)) != -1)) { 16 end--; 17 } 18 return str.substring(0, end); 19 }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/01/10 00:56