public String getStat(String code) {
   int num = 0;
   int numDex = code.length();
   while ((numDex > 0) && (Character.isDigit(code.charAt(numDex - 1)))) numDex--;
   if (numDex < code.length()) {
     num = CMath.s_int(code.substring(numDex));
     code = code.substring(0, numDex);
   }
   final GOVT_STAT_CODES stat = getStatIndex(code);
   if (stat == null) {
     return "";
   }
   switch (stat) {
     case NAME:
       return name;
     case AUTOROLE:
       return (autoRole < 0 || autoRole > positions.length) ? "" : positions[autoRole].getID();
     case ACCEPTPOS:
       return (acceptPos < 0 || acceptPos > positions.length) ? "" : positions[acceptPos].getID();
     case SHORTDESC:
       return shortDesc;
     case LONGDESC:
       return longDesc;
     case XPLEVELFORMULA:
       return xpCalculationFormulaStr == null ? "" : xpCalculationFormulaStr;
     case REQUIREDMASK:
       return requiredMaskStr;
     case ISPUBLIC:
       return Boolean.toString(isPublic);
     case ISFAMILYONLY:
       return Boolean.toString(isFamilyOnly);
     case OVERRIDEMINMEMBERS:
       return overrideMinMembers == null ? "" : overrideMinMembers.toString();
     case CONQUESTENABLED:
       return Boolean.toString(conquestEnabled);
     case CONQUESTITEMLOYALTY:
       return Boolean.toString(conquestItemLoyalty);
     case CONQUESTDEITYBASIS:
       return Boolean.toString(conquestByWorship);
     case MAXVOTEDAYS:
       return Integer.toString(maxVoteDays);
     case VOTEQUORUMPCT:
       return Integer.toString(voteQuorumPct);
     case AUTOPROMOTEBY:
       return autoPromoteBy.toString();
     case VOTEFUNCS:
       {
         final StringBuilder str = new StringBuilder("");
         for (ClanPosition pos : positions) {
           for (int a = 0; a < Function.values().length; a++)
             if (pos.getFunctionChart()[a] == Authority.MUST_VOTE_ON) {
               if (str.length() > 0) str.append(",");
               str.append(Function.values()[a]);
             }
           break;
         }
         return str.toString();
       }
     case NUMRABLE:
       return (clanAbilityNames == null) ? "0" : ("" + clanAbilityNames.length);
     case GETRABLE:
       return (clanAbilityNames == null) ? "" : ("" + clanAbilityNames[num]);
     case GETRABLEPROF:
       return (clanAbilityProficiencies == null) ? "0" : ("" + clanAbilityProficiencies[num]);
     case GETRABLEQUAL:
       return (clanAbilityQuals == null) ? "false" : ("" + clanAbilityQuals[num]);
     case GETRABLELVL:
       return (clanAbilityLevels == null) ? "0" : ("" + clanAbilityLevels[num]);
     case NUMREFF:
       return (clanEffectNames == null) ? "0" : ("" + clanEffectNames.length);
     case GETREFF:
       return (clanEffectNames == null) ? "" : ("" + clanEffectNames[num]);
     case GETREFFPARM:
       return (clanEffectParms == null) ? "0" : ("" + clanEffectParms[num]);
     case GETREFFLVL:
       return (clanEffectLevels == null) ? "0" : ("" + clanEffectLevels[num]);
     default:
       Log.errOut("Clan", "getStat:Unhandled:" + stat.toString());
       break;
   }
   return "";
 }