字符串

2018-05-31  本文已影响0人  bigfish1129
  1. 拼装特定单据号,年月日
    LocalDateTime lat = LocalDateTime.now();
    int year = lat.getYear();
    int monthValue = lat.getMonthValue();
    int dayOfMonth = lat.getDayOfMonth();
    bill.setOrderId("ABC" + year + Strings.padStart(String.valueOf(monthValue), 2, '0') + Strings.padStart(String.valueOf(dayOfMonth), 2, '0') + Strings.padStart(index, 5, '0'));

  2. 空白校验
    StringUtils.isBlank(ds.getId()) ? 0L : Long.parseLong(ds.getId())

  3. url拼接
    DTO.setUrl(this.getUrlPrefix().concat(m.getPicUrl()));

  4. 字符串拼接
    Joiner.on("_").join("ab", id, name)

  5. 删除特定字符
    String tempOrgName = cityName.replace("市", "").trim();

上一篇下一篇

猜你喜欢

热点阅读