introduced StringUtil class with .isEmpty(String input) and .isNotEmpty(String input), to replace str != null && str.length()>0 statements

This commit is contained in:
ingmargoudt 2016-09-16 20:51:51 +02:00
parent fb15c79964
commit f1cf9e7adb
47 changed files with 132 additions and 96 deletions

View file

@ -18,6 +18,7 @@ import mage.constants.CardType;
import mage.constants.MageObjectType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.util.StringUtil;
import mage.utils.CardUtil;
import mage.view.CardView;
import mage.view.CounterView;
@ -339,7 +340,7 @@ public class GuiDisplayUtil {
}
String legal = rule.toString();
if (legal.length() > 0) {
if (StringUtil.isNotEmpty(legal)) {
legal = legal.replaceAll("\\{this\\}", card.getName().isEmpty() ? "this" : card.getName());
legal = legal.replaceAll("\\{source\\}", card.getName().isEmpty() ? "this" : card.getName());
buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal, ManaSymbols.Type.TOOLTIP));