org.apache.commons.lang3.StringUtils.upperCase()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(271)

本文整理了Java中org.apache.commons.lang3.StringUtils.upperCase()方法的一些代码示例,展示了StringUtils.upperCase()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StringUtils.upperCase()方法的具体详情如下:
包路径:org.apache.commons.lang3.StringUtils
类名称:StringUtils
方法名:upperCase

StringUtils.upperCase介绍

[英]Converts a String to upper case as per String#toUpperCase().

A null input String returns null.

StringUtils.upperCase(null)  = null 
StringUtils.upperCase("")    = "" 
StringUtils.upperCase("aBc") = "ABC"

Note: As described in the documentation for String#toUpperCase(), the result of this method is affected by the current locale. For platform-independent case transformations, the method #lowerCase(String,Locale)should be used with a specific locale (e.g. Locale#ENGLISH).
[中]根据字符串#toUpperCase()将字符串转换为大写。
空输入字符串返回空值。

StringUtils.upperCase(null)  = null 
StringUtils.upperCase("")    = "" 
StringUtils.upperCase("aBc") = "ABC"

注意:如String#toUpperCase()文档中所述,此方法的结果受当前区域设置的影响。对于独立于平台的大小写转换,方法#小写(字符串,区域设置)应与特定区域设置(例如,区域设置#英语)一起使用。

代码示例

代码示例来源:origin: Graylog2/graylog2-server

@Override
  protected String apply(String value, Locale locale) {
    return StringUtils.upperCase(value, locale);
  }
}

代码示例来源:origin: joelittlejohn/jsonschema2pojo

protected String getConstantName(String nodeName, String customName) {
  if (isNotBlank(customName)) {
    return customName;
  }
  List<String> enumNameGroups = new ArrayList<>(asList(splitByCharacterTypeCamelCase(nodeName)));
  String enumName = "";
  for (Iterator<String> iter = enumNameGroups.iterator(); iter.hasNext();) {
    if (containsOnly(ruleFactory.getNameHelper().replaceIllegalCharacters(iter.next()), "_")) {
      iter.remove();
    }
  }
  enumName = upperCase(join(enumNameGroups, "_"));
  if (isEmpty(enumName)) {
    enumName = "__EMPTY__";
  } else if (Character.isDigit(enumName.charAt(0))) {
    enumName = "_" + enumName;
  }
  return enumName;
}

代码示例来源:origin: gocd/gocd

private String getEnvironmentVariableKey(String keyPattern, String givenKey) {
  return escapeEnvironmentVariable(upperCase(format(keyPattern, getName().toString(), givenKey)));
}

代码示例来源:origin: gocd/gocd

private String getEnvironmentVariableKey(String keyPattern, String givenKey) {
  return escapeEnvironmentVariable(upperCase(format(keyPattern, getName().toString(), givenKey)));
}

代码示例来源:origin: rest-assured/rest-assured

/**
   * Get the HttpRequest class that represents this request type.
   *
   * @return a non-abstract class that implements {@link HttpRequest}
   */
  static HttpRequestBase createHttpRequest(URI uri, String httpMethod, boolean hasBody) {
    String method = notNull(upperCase(trimToNull(httpMethod)), "Http method");
    Class<? extends HttpRequestBase> type = HTTP_METHOD_TO_HTTP_REQUEST_TYPE.get(method);
    final HttpRequestBase httpRequest;
    // If we are sending HTTP method that does not allow body (like GET) then HTTP library prevents
    // us from including it, however we chose to allow deviations from standard if user wants so,
    // so it needs custom handling - hence the second condition below.
    // Otherwise we should use standard implementation found in the map
    if (type == null || (!(type.isInstance(HttpEntityEnclosingRequest.class)) && hasBody)) {
      httpRequest = new CustomHttpMethod(method, uri);
    } else {
      try {
        httpRequest = type.newInstance();
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
      httpRequest.setURI(uri);
    }
    return httpRequest;
  }
}

代码示例来源:origin: org.apache.commons/commons-lang3

@Test
public void testUpperCase() {
  assertNull(StringUtils.upperCase(null));
  assertNull(StringUtils.upperCase(null, Locale.ENGLISH));
  assertEquals("upperCase(String) failed",
      "FOO TEST THING", StringUtils.upperCase("fOo test THING"));
  assertEquals("upperCase(empty-string) failed",
      "", StringUtils.upperCase(""));
  assertEquals("upperCase(String, Locale) failed",
      "FOO TEST THING", StringUtils.upperCase("fOo test THING", Locale.ENGLISH));
  assertEquals("upperCase(empty-string, Locale) failed",
      "", StringUtils.upperCase("", Locale.ENGLISH));
}

代码示例来源:origin: Graylog2/graylog2-server

@Override
  public ValueType deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
    if (p.currentTokenId() == JsonTokenId.ID_STRING) {
      final String str = StringUtils.upperCase(p.getText(), Locale.ROOT);
      try {
        return ValueType.valueOf(str);
      } catch (IllegalArgumentException e) {
        throw ctxt.weirdStringException(str, ValueType.class, e.getMessage());
      }
    } else {
      throw ctxt.wrongTokenException(p, JsonToken.VALUE_STRING, "expected String " + Arrays.toString(ValueType.values()));
    }
  }
}

代码示例来源:origin: wuyouzhuguli/FEBS-Shiro

break;
default:
  key = StringUtils.upperCase(method.getName());

代码示例来源:origin: gocd/gocd

@Override
public void populateEnvironmentContext(EnvironmentVariableContext context, MaterialRevision materialRevision, File workingDir) {
  context.setProperty(upperCase(format("GO_PACKAGE_%s_LABEL", escapeEnvironmentVariable(getName().toString()))), materialRevision.getRevision().getRevision(), false);
  for (ConfigurationProperty configurationProperty : getPackageDefinition().getRepository().getConfiguration()) {
    context.setProperty(getEnvironmentVariableKey("GO_REPO_%s_%s", configurationProperty.getConfigurationKey().getName()),

代码示例来源:origin: apache/metron

/**
 * Returns a {@link TelemetryReader} based on a property value.
 *
 * @param propertyValue The property value.
 * @return A {@link TelemetryReader}
 * @throws IllegalArgumentException If the property value is invalid.
 */
public static TelemetryReader create(String propertyValue) {
 LOG.debug("Creating telemetry reader: telemetryReader={}", propertyValue);
 TelemetryReader reader = null;
 try {
  String key = StringUtils.upperCase(propertyValue);
  TelemetryReaders strategy = TelemetryReaders.valueOf(key);
  reader = strategy.supplier.get();
 } catch(IllegalArgumentException e) {
  LOG.error("Unexpected telemetry reader: telemetryReader=" + propertyValue, e);
  throw e;
 }
 return reader;
}

代码示例来源:origin: spring-projects/spring-roo

private void setDateAnnotations(final String columnDefinition,
   final List<AnnotationMetadataBuilder> annotations) {
  // Add JSR 220 @Temporal annotation to date fields
  String temporalType =
    StringUtils.defaultIfEmpty(StringUtils.upperCase(columnDefinition), "DATE");
  if ("DATETIME".equals(temporalType)) {
   temporalType = "TIMESTAMP"; // ROO-2606
  }
  final AnnotationMetadataBuilder temporalBuilder = new AnnotationMetadataBuilder(TEMPORAL);
  temporalBuilder.addEnumAttribute("value", new EnumDetails(TEMPORAL_TYPE, new JavaSymbolName(
    temporalType)));
  annotations.add(temporalBuilder);

  final AnnotationMetadataBuilder dateTimeFormatBuilder =
    new AnnotationMetadataBuilder(DATE_TIME_FORMAT);
  dateTimeFormatBuilder.addStringAttribute("style", "M-");
  annotations.add(dateTimeFormatBuilder);
 }
}

代码示例来源:origin: org.apereo.service.persondir/person-directory-impl

@Override
  public String canonicalize(final String value, final Locale locale) {
    return StringUtils.upperCase(value, locale);
  }
},

代码示例来源:origin: kennycason/kumo

@Override
  public String apply(final String text) {
    return upperCase(text);
  }
}

代码示例来源:origin: org.onap.appc/appc-config-params-provider

private String resolveSourceStr(Parameter parameter) {
  String source = parameter.getSource();
  if (StringUtils.equalsIgnoreCase(source, "A&AI")) {
    source = "AAI";
  }
  source = StringUtils.upperCase(source);
  return source;
}

代码示例来源:origin: de.knightsoft-net/gwt-mt-widgets

@Override
public String formatValueSynchron(final String pvalue) {
 final String formatedNumber = phoneNumberUtil.formatCommonInternational(pvalue,
   StringUtils.upperCase(Objects.toString(countryCodeField.getValue(), null)));
 if (StringUtils.startsWith(pvalue, formatedNumber)) {
  return pvalue;
 }
 return StringUtils.defaultString(formatedNumber, pvalue);
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
  public String label() {
    return LocaleFactory.localizedString(StringUtils.upperCase(this.name()), "Preferences");
  }
},

代码示例来源:origin: iterate-ch/cyberduck

@Override
  public String label() {
    return LocaleFactory.localizedString(StringUtils.upperCase(this.name()), "Preferences");
  }
},

代码示例来源:origin: de.knightsoft-net/gwt-mt-widgets

@Override
public void formatValue(final ValueWithPos<String> pvalue, final boolean fireEvents) {
 setTextWithPos(
   phoneNumberUtil.formatCommonInternationalWithPos(pvalue,
     StringUtils.upperCase(Objects.toString(countryCodeField.getValue(), null))),
   fireEvents);
}

代码示例来源:origin: de.knightsoft-net/gwt-mt-widgets

@Override
public void formatValue(final ValueWithPos<String> pvalue, final boolean fireEvents) {
 setTextWithPos(phoneNumberUtil.formatE123InternationalWithPos(pvalue,
   StringUtils.upperCase(Objects.toString(countryCodeField.getValue()))), fireEvents);
}

代码示例来源:origin: de.knightsoft-net/gwt-mt-widgets

@Override
public void formatValue(final ValueWithPos<String> pvalue, final boolean fireEvents) {
 setTextWithPos(phoneNumberUtil.formatMsWithPos(pvalue,
   StringUtils.upperCase(Objects.toString(countryCodeField.getValue()))), fireEvents);
}

相关文章

StringUtils类方法