Example usage for java.lang String toUpperCase

List of usage examples for java.lang String toUpperCase

Introduction

In this page you can find the example usage for java.lang String toUpperCase.

Prototype

public String toUpperCase(Locale locale) 

Source Link

Document

Converts all of the characters in this String to upper case using the rules of the given Locale .

Usage

From source file:Main.java

public static void main(String[] args) {
    String s = "java2s.com";
    System.out.println(s.toUpperCase(Locale.getDefault()));
}

From source file:net.minecraftforge.fml.common.patcher.GenDiffSet.java

public static void main(String[] args) throws IOException {
    String sourceJar = args[0]; //Clean Vanilla jar minecraft.jar or minecraft_server.jar
    String targetDir = args[1]; //Directory containing obfed output classes, typically mcp/reobf/minecraft
    String deobfData = args[2]; //Path to FML's deobfusication_data.lzma
    String outputDir = args[3]; //Path to place generated .binpatch
    String killTarget = args[4]; //"true" if we should destroy the target file if it generated a successful .binpatch

    LogManager.getLogger("GENDIFF").log(Level.INFO,
            String.format("Creating patches at %s for %s from %s", outputDir, sourceJar, targetDir));
    Delta delta = new Delta();
    FMLDeobfuscatingRemapper remapper = FMLDeobfuscatingRemapper.INSTANCE;
    remapper.setupLoadOnly(deobfData, false);
    JarFile sourceZip = new JarFile(sourceJar);
    boolean kill = killTarget.equalsIgnoreCase("true");

    File f = new File(outputDir);
    f.mkdirs();/*from   w  ww.j av a  2  s.  c  o m*/

    for (String name : remapper.getObfedClasses()) {
        //            Logger.getLogger("GENDIFF").info(String.format("Evaluating path for data :%s",name));
        String fileName = name;
        String jarName = name;
        if (RESERVED_NAMES.contains(name.toUpperCase(Locale.ENGLISH))) {
            fileName = "_" + name;
        }
        File targetFile = new File(targetDir, fileName.replace('/', File.separatorChar) + ".class");
        jarName = jarName + ".class";
        if (targetFile.exists()) {
            String sourceClassName = name.replace('/', '.');
            String targetClassName = remapper.map(name).replace('/', '.');
            JarEntry entry = sourceZip.getJarEntry(jarName);
            byte[] vanillaBytes = toByteArray(sourceZip, entry);
            byte[] patchedBytes = Files.toByteArray(targetFile);

            byte[] diff = delta.compute(vanillaBytes, patchedBytes);

            ByteArrayDataOutput diffOut = ByteStreams.newDataOutput(diff.length + 50);
            // Original name
            diffOut.writeUTF(name);
            // Source name
            diffOut.writeUTF(sourceClassName);
            // Target name
            diffOut.writeUTF(targetClassName);
            // exists at original
            diffOut.writeBoolean(entry != null);
            if (entry != null) {
                diffOut.writeInt(Hashing.adler32().hashBytes(vanillaBytes).asInt());
            }
            // length of patch
            diffOut.writeInt(diff.length);
            // patch
            diffOut.write(diff);

            File target = new File(outputDir, targetClassName + ".binpatch");
            target.getParentFile().mkdirs();
            Files.write(diffOut.toByteArray(), target);
            Logger.getLogger("GENDIFF").info(String.format("Wrote patch for %s (%s) at %s", name,
                    targetClassName, target.getAbsolutePath()));
            if (kill) {
                targetFile.delete();
                Logger.getLogger("GENDIFF").info(String.format("  Deleted target: %s", targetFile.toString()));
            }
        }
    }
    sourceZip.close();
}

From source file:Main.java

public static String capitalize(String input) {
    return input.toUpperCase(new Locale(Locale.ENGLISH.getLanguage(), Locale.US.getCountry()));
}

From source file:Main.java

static boolean isKeyword(String term) {
    return KEYWORDS.contains(term.toUpperCase(Locale.ENGLISH));
}

From source file:Main.java

public static boolean isEmpty(String str) {
    return null == str || "".equals(str) || "NULL".equals(str.toUpperCase(Locale.CHINA));
}

From source file:Main.java

/**
 * Constructs a key string from the received deviceId and the appId
 * /* w w  w .  jav a2s. c  o  m*/
 * @param deviceId
 * @param appId
 * @return key
 */
public static String getKey(String deviceId, UUID appId) {

    String appIdStr = appId.toString().replace("-", "");
    return deviceId + "_" + appIdStr.toUpperCase(Locale.ENGLISH);
}

From source file:Main.java

public final static String convertFristToUpperCase(String temp) {
    String frist = temp.substring(0, 1);
    String other = temp.substring(1);
    return frist.toUpperCase(Locale.getDefault()) + other;
}

From source file:Main.java

/** Convert string to uppercase
 * Always use the java.util.ENGLISH locale
 * @param s   string to uppercase//from www  .  j  a v a2s .co  m
 * @return uppercased string
 */
public static String SQLToUpperCase(String s) {
    return s.toUpperCase(Locale.ENGLISH);
}

From source file:com.uk_postcodes.api.Postcode.java

/**
 * Checks the candidate postcode against the Royal Mail approved regex
 * @param postcode the postcode to validate
 * @return true if the postcode is valid
 *//*from w  w w.  j  av a 2  s .com*/
public static boolean isValid(String postcode) {
    return postcodePattern.matcher(postcode.toUpperCase(Locale.UK)).matches();
}

From source file:gov.nih.nci.caarray.web.util.UserComparator.java

/**
 * Extracts last and first name from a string like <code>&lt;a href="..."&gt;last, first&lt;/a&gt;</code>.
 * @param s the html to extrat names from
 * @return UPPER(last), UPPER(first)//from   w w w.  j a v a  2  s . c o m
 */
public static String[] getNames(String s) {
    Pattern p = Pattern.compile("[^>]*>\\s*(.*),\\s*(.*)<[^<]*");
    Matcher m = p.matcher(s.toUpperCase(Locale.US));
    m.lookingAt();
    return new String[] { m.group(1).trim(), m.group(2).trim() };
}