mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 12:22:10 -08:00
decks: improved deck import to support unicode card names from LTR, UGL and other sets, added verify tests for name converters (closes #10465)
This commit is contained in:
parent
eebb82c591
commit
d91147f01a
3 changed files with 78 additions and 16 deletions
|
|
@ -6,22 +6,34 @@ public class CardNameUtil {
|
|||
|
||||
public static final Pattern CARD_NAME_PATTERN = Pattern.compile("[ !\"&',\\-./0-9:A-Za-z]+");
|
||||
|
||||
/**
|
||||
* Convert card names with unicode symbols to ascii, uses to deck import from a third party services
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static String normalizeCardName(String name) {
|
||||
// new symbols checks in verify test, no need to manually search it
|
||||
return name
|
||||
.replace("&", "//")
|
||||
.replace("///", "//")
|
||||
.replace("Æ", "Ae")
|
||||
.replace("ö", "A")
|
||||
.replace("ö", "o")
|
||||
.replace("û", "u")
|
||||
.replace("í", "i")
|
||||
.replace("â", "a")
|
||||
.replace("á", "a")
|
||||
.replace("à", "a")
|
||||
.replace("é", "e")
|
||||
.replace("ú", "u")
|
||||
.replace("†", "+")
|
||||
.replace("★", "*");
|
||||
.replace("&", "//")
|
||||
.replace("///", "//")
|
||||
.replace("Æ", "Ae")
|
||||
.replace("ö", "A")
|
||||
.replace("ö", "o")
|
||||
.replace("û", "u")
|
||||
.replace("í", "i")
|
||||
.replace("â", "a")
|
||||
.replace("á", "a")
|
||||
.replace("à", "a")
|
||||
.replace("é", "e")
|
||||
.replace("ú", "u")
|
||||
.replace("†", "+")
|
||||
.replace("★", "*")
|
||||
.replace("ó", "o")
|
||||
.replace("ä", "a")
|
||||
.replace("ü", "u")
|
||||
.replace("É", "E")
|
||||
.replace("ñ", "n")
|
||||
.replace("®", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue