Solved Untranslate a String

Discussion in 'Plugin Development' started by micrlink, Jul 26, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    micrlink

    Can I go from
    RedOrangeYellow
    to
    &cRed &6Orange &eYellow
     
  2. Offline

    xTigerRebornx

  3. Offline

    k9rosie

    ChatColor.stripColor(string)

    although you'll just get a regular string with this, the ampersand and numbers will not be included
     
  4. Offline

    micrlink

    Got it
    Code:
    public String untranslateChar (String s) {
            return s.replaceAll("" + ChatColor.COLOR_CHAR, "&");
        }
     
  5. Offline

    Dragonphase

    micrlink

    Just a heads up, String#replaceAll is primarily used for Regular Expressions. You should use s.replace(ChatColor.COLOR_CHAR, '&');
     
Thread Status:
Not open for further replies.

Share This Page