List of usage examples for java.lang String toUpperCase
public String toUpperCase()
From source file:com.iksgmbh.sql.pojomemodb.utils.StringParseUtil.java
/** * Finds the valid position to cut. Example: * For input="Number(10,0)," the position of the second comma (12 not 9) is valid! * // ww w.j a v a2 s . c om * @param input * @return next valid position of a comma to be used for cutting */ private static int getNextValidCommaPosition(final String input) { if (!input.contains(COMMA)) { return -1; } if (input.toUpperCase().startsWith("NUMBER")) { int posOfClosingParenthesis = input.indexOf(CLOSING_PARENTHESIS); int posOfComma = input.indexOf(COMMA); if (posOfComma < posOfClosingParenthesis) { String inputPart = input.substring(posOfClosingParenthesis); posOfComma = inputPart.indexOf(COMMA); if (posOfComma == -1) return -1; // no valid comma found return posOfClosingParenthesis + posOfComma; } } return input.indexOf(COMMA); }
From source file:th.co.geniustree.dental.spec.DoctorSpec.java
public static Specification<Doctor> nameLike(final String keyword) { return new Specification<Doctor>() { @Override//from w ww. j av a2 s . c om public Predicate toPredicate(Root<Doctor> root, CriteriaQuery<?> cq, CriteriaBuilder cb) { return cb.or(cb.like(root.get(Doctor_.nameTh), keyword), cb.like(cb.upper(root.get(Doctor_.nameEng)), keyword.toUpperCase())); } }; }
From source file:com.baasbox.controllers.Social.java
@With({ AdminCredentialWrapFilter.class, ConnectToDBFilter.class }) @BodyParser.Of(BodyParser.Json.class) public static Result authorizationUrl(String socialNetwork) { String keyFormat = socialNetwork.toUpperCase() + "_ENABLED"; Boolean enabled = SocialLoginConfiguration.valueOf(keyFormat).getValueAsBoolean(); if (enabled == null || enabled == false) { return badRequest("Social login for " + socialNetwork + " is not enabled"); } else {//ww w . ja va 2 s . c o m SocialLoginService sc = SocialLoginService.by(socialNetwork, (String) ctx().args.get("appcode")); return ok("{\"url\":\"" + sc.getAuthorizationURL(session()) + "\"}"); } }
From source file:com.jkoolcloud.tnt4j.streams.transform.FuncGetObjectName.java
private static String resolveObjectName(String objectName, List<?> args) { String option = args.size() > 1 ? (String) args.get(1) : null; Options opt;// w w w .j ava2 s . c om try { opt = StringUtils.isEmpty(option) ? Options.DEFAULT : Options.valueOf(option.toUpperCase()); } catch (IllegalArgumentException exc) { opt = Options.DEFAULT; } switch (opt) { case FULL: break; case BEFORE: String sSymbol = args.size() > 2 ? (String) args.get(2) : null; if (StringUtils.isNotEmpty(sSymbol)) { objectName = StringUtils.substringBefore(objectName, sSymbol); } break; case AFTER: sSymbol = args.size() > 2 ? (String) args.get(2) : null; if (StringUtils.isNotEmpty(sSymbol)) { objectName = StringUtils.substringAfter(objectName, sSymbol); } break; case REPLACE: sSymbol = args.size() > 2 ? (String) args.get(2) : null; if (StringUtils.isNotEmpty(sSymbol)) { String rSymbol = args.size() > 3 ? (String) args.get(3) : null; objectName = StringUtils.replaceChars(objectName, sSymbol, rSymbol == null ? "" : rSymbol); } break; case SECTION: String idxStr = args.size() > 2 ? (String) args.get(2) : null; int idx; try { idx = Integer.parseInt(idxStr); } catch (Exception exc) { idx = -1; } if (idx >= 0) { sSymbol = args.size() > 3 ? (String) args.get(3) : null; String[] onTokens = StringUtils.split(objectName, StringUtils.isEmpty(sSymbol) ? OBJ_NAME_TOKEN_DELIMITERS : sSymbol); objectName = idx < ArrayUtils.getLength(onTokens) ? onTokens[idx] : objectName; } break; case DEFAULT: default: idx = StringUtils.indexOfAny(objectName, OBJ_NAME_TOKEN_DELIMITERS); if (idx > 0) { objectName = StringUtils.substring(objectName, 0, idx); } break; } return objectName; }
From source file:name.martingeisse.phunky.runtime.variable.TypeConversionUtil.java
/** * Converts the specified value to a string value. * @param value the original value//from w w w.j a v a 2 s .c o m * @return the converted value */ public static String convertToString(Object value) { if (value == null) { return ""; } if (value instanceof Boolean) { Boolean v = (Boolean) value; return (v ? "1" : ""); } if (value instanceof PhpValueArray) { return "Array"; } if (value instanceof Float || value instanceof Double) { String s = String.format("%.14g", value); int decimalPointIndex = s.indexOf('.'); if (decimalPointIndex == -1) { return s.toUpperCase(); } int exponentSeparatorIndex = s.indexOf('e', decimalPointIndex + 1); if (exponentSeparatorIndex == -1) { s = StringUtils.stripEnd(s, "0"); s = StringUtils.stripEnd(s, "."); return s; } String mantissa = StringUtils.stripEnd(s.substring(0, exponentSeparatorIndex), "0"); if (mantissa.charAt(mantissa.length() - 1) == '.') { mantissa += '0'; } return mantissa + 'E' + s.substring(exponentSeparatorIndex + 1); } return value.toString(); }
From source file:th.co.geniustree.dental.spec.StaffSpec.java
public static Specification<Staff> nameLike(final String keyword) { return new Specification<Staff>() { @Override/*from w w w . j a v a2s .c om*/ public Predicate toPredicate(Root<Staff> root, CriteriaQuery<?> cq, CriteriaBuilder cb) { return cb.or(cb.like(root.get(Staff_.nameTh), keyword), cb.like(cb.upper(root.get(Staff_.nameEng)), keyword.toUpperCase())); } }; }
From source file:controllers.SiteApp.java
/** * @param pageNum page number//from w w w . j a v a2 s .c om * @return the result */ public static Result issueList(int pageNum) { String state = StringUtils.defaultIfBlank(request().getQueryString("state"), State.OPEN.name()); State currentState = State.valueOf(state.toUpperCase()); Page<Issue> page = Issue.findIssuesByState(ISSUE_COUNT_PER_PAGE, pageNum - 1, currentState); return ok(issueList.render("title.siteSetting", page, currentState)); }
From source file:eu.europa.ejusticeportal.dss.applet.model.token.CertificateDisplayUtils.java
private static String formatSerialNumber(BigInteger bi) { if (bi == null) { return ""; }//from w ww . j a va 2s.c o m String sn = bi.toString(16); char[] chars = sn.toUpperCase().toCharArray(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < chars.length; i++) { sb.append(chars[i]); if ((i + 1) % 2 == 0 && i < chars.length - 1) { sb.append(' '); } } return sb.toString(); }
From source file:gobblin.writer.partitioner.TimeBasedWriterPartitioner.java
private static DatePartitionType getGranularity(State state, int numBranches, int branchId) { String propName = ForkOperatorUtils.getPropertyNameForBranch(WRITER_PARTITION_GRANULARITY, numBranches, branchId);//from w ww .ja v a2 s. c om String granularityValue = state.getProp(propName, DEFAULT_WRITER_PARTITION_GRANULARITY.toString()); Optional<DatePartitionType> granularity = Enums.getIfPresent(DatePartitionType.class, granularityValue.toUpperCase()); Preconditions.checkState(granularity.isPresent(), granularityValue + " is not a valid writer partition granularity"); return granularity.get(); }
From source file:de.fosd.jdime.config.JDimeConfig.java
/** * Set the logging level. The levels in descending order are:<br> * * <ul>/* www. ja v a2 s . c om*/ * <li>ALL</li> * <li>SEVERE (highest value)</li> * <li>WARNING</li> * <li>INFO</li> * <li>CONFIG</li> * <li>FINE</li> * <li>FINER</li> * <li>FINEST (lowest value)</li> * <li>OFF</li> * </ul> * * @param logLevel * one of the valid log levels according to {@link Level#parse(String)} */ public static void setLogLevel(String logLevel) { Level level; try { level = Level.parse(logLevel.toUpperCase()); } catch (IllegalArgumentException e) { LOG.warning( () -> "Invalid log level %s. Must be one of OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST or ALL."); return; } Logger root = Logger.getLogger(Main.class.getPackage().getName()); root.setLevel(level); for (Handler handler : root.getHandlers()) { handler.setLevel(level); } }