Refactor ReplaceAll

This commit is contained in:
Anthony Calosa
2020-10-23 17:51:57 +08:00
parent 1e3be648ca
commit 04be4ce993
3 changed files with 6 additions and 3 deletions

View File

@@ -23,6 +23,7 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont.BitmapFontData;
import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph;
import com.badlogic.gdx.graphics.g2d.PixmapPacker.Page;
import com.badlogic.gdx.utils.Array;
import forge.util.TextUtil;
/**
* This file is 'borrowed' from gdx-tools in the libgdx source
@@ -201,7 +202,7 @@ public class BitmapFontWriter {
: " alphaChnl=0 redChnl=0 greenChnl=0 blueChnl=0";
// INFO LINE
buf.append(xmlOpen).append("info face=\"").append(info.face == null ? "" : info.face.replaceAll("\"", "'"))
buf.append(xmlOpen).append("info face=\"").append(info.face == null ? "" : TextUtil.fastReplace(info.face,"\"", "'"))
.append("\" size=").append(quote(info.size)).append(" bold=").append(quote(info.bold ? 1 : 0)).append(" italic=")
.append(quote(info.italic ? 1 : 0)).append(" charset=\"").append(info.charset == null ? "" : info.charset)
.append("\" unicode=").append(quote(info.unicode ? 1 : 0)).append(" stretchH=").append(quote(info.stretchH))

View File

@@ -16,6 +16,7 @@ import forge.screens.match.views.VPrompt;
import forge.toolbox.FButton.Corner;
import forge.toolbox.FEvent.FEventHandler;
import forge.util.PhysicsObject;
import forge.util.TextUtil;
import forge.util.Utils;
public abstract class FDialog extends FOverlay {
@@ -48,7 +49,7 @@ public abstract class FDialog extends FOverlay {
buttonCount = buttonCount0;
prompt = add(new VPrompt("", "", null, null));
if (buttonCount < 3) {
title0 = title0.replaceAll(" - ", "\n"); //breakup into lines
title0 = TextUtil.fastReplace(title0," - ", "\n"); //breakup into lines
btnMiddle = null;
prompt.setMessage(title0); //only put title in message if no third button
}

View File

@@ -35,6 +35,7 @@ import forge.game.event.GameEventZone;
import forge.game.event.IGameEventVisitor;
import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType;
import forge.util.TextUtil;
import forge.util.maps.MapOfLists;
/**
@@ -213,7 +214,7 @@ public class EventVisualizer extends IGameEventVisitor.Base<SoundEffectType> imp
}
}
// No interest if "colors together" or "alternative colors" - only interested in colors themselves
fullManaColors = new StringBuilder(fullManaColors.toString().replaceAll("\\s", ""));
fullManaColors = new StringBuilder(TextUtil.fastReplace(fullManaColors.toString()," ", ""));
int fullManaColorsLength = fullManaColors.length();