slash.common.io.Transfer.trim()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(130)

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

Transfer.trim介绍

暂无

代码示例

代码示例来源:origin: cpesch/RouteConverter

protected String concatPath(String path, String fragment) {
  path = trim(path);
  fragment = trim(fragment);
  String result = path != null ? path : "";
  if (fragment != null)
    result = result + "/" + fragment;
  return result;
}

代码示例来源:origin: cpesch/RouteConverter

private String extractValue(Characters chars, String value) {
  String append = trim(chars.getData());
  if (append == null)
    return value;
  if (value == null)
    return append;
  return value + append;
}

代码示例来源:origin: cpesch/RouteConverter

protected String asName(String description) {
  if (description == null)
    return null;
  int index = description.indexOf(';');
  if (index != -1)
    description = description.substring(0, index);
  return trim(description);
}

代码示例来源:origin: cpesch/RouteConverter

protected String asDesc(String description) {
  if (description == null)
    return null;
  int index = description.indexOf(';');
  if (index != -1) {
    description = description.substring(index + 1);
    return trim(description);
  } else
    return null;
}

代码示例来源:origin: cpesch/RouteConverter

private CompactCalendar parseDateAndTime(String date, String time) {
  date = trim(date);
  time = trim(time);
  if(date == null || time == null)
    return null;
  String dateAndTime = date + " " + time;
  return parseDate(dateAndTime, DATE_AND_TIME_FORMAT);
}

代码示例来源:origin: cpesch/RouteConverter

public static Integer parseInteger(String string) {
  String trimmed = trim(string);
  if (trimmed != null) {
    if (trimmed.startsWith("+"))
      trimmed = trimmed.substring(1);
    return Integer.parseInt(trimmed);
  } else
    return null;
}

代码示例来源:origin: cpesch/RouteConverter

public static String trim(String string, int length) {
  string = trim(string);
  if (string == null)
    return null;
  return string.substring(0, min(string.length(), length));
}

代码示例来源:origin: cpesch/RouteConverter

private static String parseForNmn4(String string) {
  String result = trim(string);
  if ("-".equals(result))
    result = null;
  // this was currently only in NMN5, try it out for NMN4, too
  if (result != null && result.length() > 2)
    result = toMixedCase(result);
  return result;
}

代码示例来源:origin: cpesch/RouteConverter

protected String asDesc(String description, String defaultValue) {
  String result = asDesc(description);
  if (result == null)
    result = trim(defaultValue);
  return result;
}

代码示例来源:origin: cpesch/RouteConverter

private CompactCalendar parseDateAndTime(String date, String time) {
  time = trim(time);
  date = trim(date);
  if (date == null)
    return parseDate(time, TIME_FORMAT);
  String dateAndTime = date + " " + time;
  return parseDate(dateAndTime, DATE_AND_TIME_FORMAT);
}

代码示例来源:origin: cpesch/RouteConverter

protected NmnPosition parsePosition(String line, ParserContext context) {
  Matcher lineMatcher = POSITION_PATTERN.matcher(line);
  if (!lineMatcher.matches())
    throw new IllegalArgumentException("'" + line + "' does not match");
  String city = trim(lineMatcher.group(1));
  String longitude = lineMatcher.group(2);
  String latitude = lineMatcher.group(3);
  String street = trim(lineMatcher.group(4));
  String description = toMixedCase(city != null ? city + (street != null ? ", " + street : "") : "");
  return new NmnPosition(parseDouble(longitude), parseDouble(latitude), (Double) null, null, null, trim(description));
}

代码示例来源:origin: cpesch/RouteConverter

private List<DistanceAndTime> parseDistanceAndTimeParameters(String parameters) {
  List<DistanceAndTime> result = new ArrayList<>();
  StringTokenizer tokenizer = new StringTokenizer(parameters, "/");
  while (tokenizer.hasMoreTokens()) {
    String distance = trim(tokenizer.nextToken());
    if (tokenizer.hasMoreTokens()) {
      String time = trim(tokenizer.nextToken());
      result.add(new DistanceAndTime(parseDouble(distance), parseLong(time)));
    }
  }
  return result;
}

代码示例来源:origin: cpesch/RouteConverter

protected Wgs84Position parsePosition(String line, ParserContext context) {
  Matcher lineMatcher = LINE_PATTERN.matcher(line);
  if (!lineMatcher.matches())
    throw new IllegalArgumentException("'" + line + "' does not match");
  String longitude = lineMatcher.group(1);
  String latitude = lineMatcher.group(2);
  String description = trim(lineMatcher.group(3));
  if (description != null)
    description = description.replaceAll("\\p{Cntrl}", "");
  return asWgs84Position(parseDouble(longitude), parseDouble(latitude), description);
}

代码示例来源:origin: cpesch/RouteConverter

GkPosition parsePosition(String line) {
  Matcher lineMatcher = POSITION_PATTERN.matcher(line);
  if (!lineMatcher.matches())
    throw new IllegalArgumentException("'" + line + "' does not match");
  Double right = parseDouble(lineMatcher.group(1));
  Double height = parseDouble(lineMatcher.group(2));
  String description = trim(lineMatcher.group(3));
  return new GkPosition(right, height, description);
}

代码示例来源:origin: cpesch/RouteConverter

private boolean isAuthenticated(List<String> lines) {
  Map<String, String> map = asMap(lines);
  String host = trim(map.get("Host"));
  return host != null && host.equals("127.0.0.1:" + getCallbackPort());
}

代码示例来源:origin: cpesch/RouteConverter

Wgs84Position parseCommentPosition(String position) {
  Matcher matcher = COMMENT_POSITION_PATTERN.matcher(position);
  if (!matcher.matches())
    throw new IllegalArgumentException("'" + position + "' does not match");
  String comment = trim(matcher.group(1));
  Double latitude = parseDouble(matcher.group(3));
  Double longitude = parseDouble(matcher.group(4));
  return asWgs84Position(longitude, latitude, comment);
}

代码示例来源:origin: cpesch/RouteConverter

protected Wgs84Position parsePosition(String line, ParserContext context) {
  Matcher lineMatcher = LINE_PATTERN.matcher(line);
  if (!lineMatcher.matches())
    throw new IllegalArgumentException("'" + line + "' does not match");
  String longitude = lineMatcher.group(1);
  String latitude = lineMatcher.group(2);
  String description = toMixedCase(trim(lineMatcher.group(3)));
  return asWgs84Position(parseDouble(longitude), parseDouble(latitude), description);
}

代码示例来源:origin: cpesch/RouteConverter

public String getShortUrl() {
    String string = trim(getString());
    return string != null ? lastPathFragment(string, 60) : null;
  }
}

代码示例来源:origin: cpesch/RouteConverter

private void addFile() {
  String description = textFieldDescription.getText();
  if (trim(description) == null) {
    labelResult.setText(RouteConverter.getBundle().getString("add-route-no-description-error"));
    pack();
    return;
  }
  catalogModel.addRoute(category, description, file, null, new AddRouteCallback());
  labelResult.setText(RouteConverter.getBundle().getString("add-route-by-file-success"));
  pack();
  dispose();
}

代码示例来源:origin: cpesch/RouteConverter

public String getAPIKey(String serviceName, String apiType) {
  count(preferences, serviceName + API_USAGES + "-" + apiType);
  String apiKey = trim(getAPIKeyPreference(serviceName));
  return apiKey != null ? apiKey : getDefaultAPIKey(serviceName);
}

相关文章