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() 

Source Link

Document

Converts all of the characters in this String to upper case using the rules of the default locale.

Usage

From source file:Main.java

/**
 * Regex matcher for PART X pattern in multi-part videos
 * http://txt2re.com/index-java.php3/*  w  ww.  j  a  v  a2 s.c o  m*/
 * 
 * @param token
 * @return
 */
@SuppressLint("DefaultLocale")
private static boolean isMultiPartSeries(String token) {
    String re1 = "(PART)"; // Word 1
    String re2 = "( )"; // White Space 1
    String re3 = "(\\d+)"; // Integer Number 1

    Pattern p = Pattern.compile(re1 + re2 + re3, Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
    Matcher m = p.matcher(token.toUpperCase());

    return m.find();
}

From source file:th.co.geniustree.intenship.advisor.spec.AccountSpec.java

public static Specification<Account> emailLike(final String keyword) {
    return new Specification<Account>() {

        @Override/* w  w  w. j av a  2s.com*/
        public Predicate toPredicate(Root<Account> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Account_.email)), keyword.toUpperCase());
        }
    };
}

From source file:model.SongMeaningsScraper.java

private static String validateSong(String artist, String title) {
    HashMap<String, String> songList = DataManager.getSongMap().get(artist);
    for (String songFromMap : songList.keySet()) {
        int levDist = StringUtils.getLevenshteinDistance(songFromMap.toUpperCase(), title.toUpperCase());
        double ratio = (songFromMap.length() - levDist + 0.0) / (songFromMap.length() + 0.0);
        if (ratio == 1.0) {
            Logger.LogToStatusBar(songFromMap + " exactly matches");
            return songFromMap;
        } else if (ratio >= 0.5) {
            ArrayList<String> matches = DataManager.getSongMatches().get(artist + " " + title);
            if (matches == null) {
                matches = new ArrayList<String>();
                matches.add(songFromMap);
                DataManager.getSongMatches().put(artist + " " + title, matches);
            } else {
                matches.add(songFromMap);
                DataManager.getSongMatches().remove(artist + " " + title);
                DataManager.getSongMatches().put(artist + " " + title, matches);
            }//from  w ww .  java  2s  .  c  o m
        }
    }
    return "";
}

From source file:th.co.geniustree.dental.spec.LotSpec.java

public static Specification<Lot> nameStaffReamLike(final String keyword) {
    return new Specification<Lot>() {

        @Override//from  www  .j  av a2s . c  o m
        public Predicate toPredicate(Root<Lot> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Lot_.nameStaffReam)), keyword.toUpperCase());
        }
    };
}

From source file:edu.sfsu.cs.orange.ocr.language.TranslatorTinymid.java

/**
 * Convert the given name of a natural language into a language code from the enum of Languages 
 * supported by this translation service.
 * //from   ww w  .j ava  2  s  .c o  m
 * @param languageName The name of the language, for example, "English"
 * @return code representing this language, for example, "en", for this translation API
 * @throws IllegalArgumentException
 */
public static String toLanguage(String languageName) throws IllegalArgumentException {
    // Convert string to all caps
    String standardizedName = languageName.toUpperCase();

    // Replace spaces with underscores
    standardizedName = standardizedName.replace(' ', '_');

    // Remove parentheses
    standardizedName = standardizedName.replace("(", "");
    standardizedName = standardizedName.replace(")", "");

    // Hack to fix misspelling in google-api-translate-java
    if (standardizedName.equals("UKRAINIAN")) {
        standardizedName = "UKRANIAN";
    }

    // Map Norwegian-Bokmal to Norwegian
    if (standardizedName.equals("NORWEGIAN_BOKMAL")) {
        standardizedName = "NORWEGIAN";
    }

    try {
        return Language.valueOf(standardizedName).toString();
    } catch (IllegalArgumentException e) {
        Log.e(TAG, "Not found--returning default language code");
        return CaptureActivity.DEFAULT_TARGET_LANGUAGE_CODE;
    }
}

From source file:com.charity.core.controller.Servlets.java

/**
 * ??Header.//from  www  .  j av a2 s . c  o  m
 * 
 * @param fileName ???.
 */
public static void setFileDownloadHeader(HttpServletRequest request, HttpServletResponse response,
        String fileName) {
    // ???
    String encodedfileName;
    // ??firefox??,???+?
    fileName = fileName.trim().replaceAll(" ", "_");

    String agent = request.getHeader("User-Agent");
    boolean isMSIE = (agent != null && agent.toUpperCase().contains("MSIE"));
    if (isMSIE) {
        encodedfileName = Encodes.urlEncode(fileName);
    } else {
        encodedfileName = new String(fileName.getBytes(), Charsets.ISO_8859_1);
    }

    response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + encodedfileName + "\"");

}

From source file:model.SongMeaningsScraper.java

public static String validateArtist(String artist) {
    HashMap<String, String> artists = DataManager.getArtistMap();
    for (String artistFromMap : artists.keySet()) {
        int levDist = StringUtils.getLevenshteinDistance(artistFromMap.toUpperCase(), artist.toUpperCase());
        double ratio = (artistFromMap.length() - levDist + 0.0) / (artistFromMap.length() + 0.0);
        if (ratio == 1.0) {
            Logger.LogToStatusBar(artistFromMap + " exactly matches");
            return artistFromMap;
        } else if (ratio >= 0.5) {
            ArrayList<String> matches = DataManager.getArtistMatches().get(artist);
            if (matches == null) {
                matches = new ArrayList<String>();
                matches.add(artistFromMap);
                DataManager.getArtistMatches().put(artist, matches);
            } else {
                matches.add(artistFromMap);
                DataManager.getArtistMatches().remove(artist);
                DataManager.getArtistMatches().put(artist, matches);
            }//from  w  ww . j a  v a 2 s .  c  om
        }
    }
    return "";
}

From source file:th.co.geniustree.dental.spec.DepartmentSpec.java

public static Specification<Department> namelike(final String keyword) {
    return new Specification<Department>() {

        @Override//from w ww .j ava  2s  . c o m
        public Predicate toPredicate(Root<Department> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(Department_.name)), keyword.toUpperCase());
        }
    };
}

From source file:com.spotify.reaper.ReaperApplication.java

public static void checkRepairParallelismString(String givenRepairParallelism) throws ReaperException {
    try {//from w w  w. ja  va 2 s  .  c o m
        RepairParallelism.valueOf(givenRepairParallelism.toUpperCase());
    } catch (java.lang.IllegalArgumentException ex) {
        throw new ReaperException("invalid repair parallelism given \"" + givenRepairParallelism
                + "\", must be one of: " + Arrays.toString(RepairParallelism.values()), ex);
    }
}

From source file:com.jaeksoft.searchlib.util.ActiveDirectory.java

private static String getDomainSearch(String domain) {
    String[] dcs = StringUtils.split(domain.toUpperCase(), '.');
    StringBuilder sb = new StringBuilder();
    for (String dc : dcs) {
        if (sb.length() > 0)
            sb.append(',');
        sb.append("DC=");
        sb.append(dc);// ww  w.  j  a  v a 2  s  .c om
    }
    return sb.toString();
}