本文整理了Java中slash.common.io.Transfer.escape()
方法的一些代码示例,展示了Transfer.escape()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transfer.escape()
方法的具体详情如下:
包路径:slash.common.io.Transfer
类名称:Transfer
方法名:escape
暂无
代码示例来源:origin: cpesch/RouteConverter
protected String escape(String string) {
return Transfer.escape(string, SEPARATOR, ';', "-");
}
}
代码示例来源:origin: cpesch/RouteConverter
public static String escape(String string, char escape, char replacement) {
return escape(string, escape, replacement, "");
}
代码示例来源:origin: cpesch/RouteConverter
private String escape(String string) {
string = Transfer.escape(string, SEPARATOR, ';');
if (string != null)
string = string.replaceAll("\u20ac", "\u0080");
return string;
}
代码示例来源:origin: cpesch/RouteConverter
private static String escape(String string) {
string = Transfer.escape(string, SEPARATOR, ';');
return string != null ? string.toUpperCase() : "";
}
代码示例来源:origin: cpesch/RouteConverter
private static String formatDescription(String string) {
return escape(string, QUOTE, ';').replaceAll("<", " ").replaceAll(">", " ");
}
代码示例来源:origin: cpesch/RouteConverter
private String escape(String string, int maximumLength) {
string = Transfer.escape(string, '"', '\'');
return string != null ? string.substring(0, Math.min(string.length(), maximumLength)) : null;
}
代码示例来源:origin: cpesch/RouteConverter
private void writeRte(NmeaPosition start, NmeaPosition end, PrintWriter writer, int count, int index, String routeName) {
String startName = escape(start.getDescription(), SEPARATOR, ';');
String rte = "PMGNRTE" + SEPARATOR + count + SEPARATOR + (index + 1) + SEPARATOR +
"c" + SEPARATOR + "01" + SEPARATOR + routeName + SEPARATOR + startName + SEPARATOR + "a";
if (end != null) {
String endName = escape(end.getDescription(), SEPARATOR, ';');
rte += SEPARATOR + endName + SEPARATOR + "a";
}
writeSentence(writer, rte);
}
代码示例来源:origin: cpesch/RouteConverter
public void setDescription(String description) {
this.description = description;
this.street = null;
this.number = null;
if (description == null)
return;
Matcher matcher = DESCRIPTION_PATTERN.matcher(escape(description, SEPARATOR, ';'));
if (matcher.matches()) {
this.description = trim(matcher.group(2));
zip = trim(matcher.group(1));
street = trim(matcher.group(3));
number = trim(matcher.group(4));
}
}
代码示例来源:origin: cpesch/RouteConverter
protected void writePosition(Wgs84Position position, PrintWriter writer, int index, boolean firstPosition) {
String longitude = formatDoubleAsString(position.getLongitude(), 7);
String latitude = formatDoubleAsString(position.getLatitude(), 7);
String description = escape(position.getDescription(), SEPARATOR, ';');
description = escape(description, '\"', ';');
writer.println(latitude + SEPARATOR + longitude + SEPARATOR + description);
}
}
代码示例来源:origin: cpesch/RouteConverter
protected void writePosition(Wgs84Position position, PrintWriter writer, int index, boolean firstPosition) {
String longitude = formatDoubleAsString(position.getLongitude(), 7);
String latitude = formatDoubleAsString(position.getLatitude(), 7);
String description = escape(position.getDescription(), SEPARATOR, ';');
writer.println(longitude + SEPARATOR + latitude + SEPARATOR + "\"" + description + "\"");
}
}
代码示例来源:origin: cpesch/RouteConverter
protected void writePosition(NmeaPosition position, PrintWriter writer) {
ValueAndOrientation longitudeAsValueAndOrientation = position.getLongitudeAsValueAndOrientation();
String longitude = formatLongitude(longitudeAsValueAndOrientation.getValue());
String westOrEast = longitudeAsValueAndOrientation.getOrientation().value();
ValueAndOrientation latitudeAsValueAndOrientation = position.getLatitudeAsValueAndOrientation();
String latitude = formatLatitude(latitudeAsValueAndOrientation.getValue());
String northOrSouth = latitudeAsValueAndOrientation.getOrientation().value();
String description = escape(position.getDescription(), SEPARATOR, ';');
String altitude = formatIntAsString(position.getElevation() != null ? position.getElevation().intValue() : null);
String wpl = "PMGNWPL" + SEPARATOR +
latitude + SEPARATOR + northOrSouth + SEPARATOR + longitude + SEPARATOR + westOrEast + SEPARATOR +
altitude + SEPARATOR + "M" + SEPARATOR + description + SEPARATOR + SEPARATOR + "a";
writeSentence(writer, wpl);
}
代码示例来源:origin: cpesch/RouteConverter
protected void writePosition(Wgs84Position position, PrintWriter writer, int index, boolean firstPosition) {
String date = fillWithZeros(formatDate(position.getTime()), 6);
String time = fillWithZeros(formatTime(position.getTime()), 6);
String latitude = formatDoubleAsString(abs(position.getLatitude()), 6);
String northOrSouth = position.getLatitude() != null && position.getLatitude() < 0.0 ? "S" : "N";
String longitude = formatDoubleAsString(abs(position.getLongitude()), 6);
String westOrEast = position.getLongitude() != null && position.getLongitude() < 0.0 ? "W" : "E";
String height = fillWithZeros(position.getElevation() != null ? formatIntAsString(position.getElevation().intValue()) : "0", 5);
String speed = position.getSpeed() != null ? formatDoubleAsString(position.getSpeed()) : "0";
String heading = fillWithZeros(position.getHeading() != null ? formatIntAsString(position.getHeading().intValue()) : "0", 3);
String pressure = position.getPressure() != null ? formatDoubleAsString(position.getPressure()) : "0";
String temperature = fillWithZeros(position.getTemperature() != null ? formatIntAsString(position.getTemperature().intValue()) : "0", 2);
String description = !isPositionDescription(position.getDescription()) ? position.getDescription() : "";
writer.println(fillWithZeros(Integer.toString(index + 1), 6) + SEPARATOR +
formatTag(position) + SEPARATOR +
date + SEPARATOR + time + SEPARATOR +
latitude + northOrSouth + SEPARATOR +
longitude + westOrEast + SEPARATOR +
height + SEPARATOR +
speed + SEPARATOR +
heading + SEPARATOR +
pressure + SEPARATOR +
temperature + SEPARATOR +
fillWithZeros(escape(description, SEPARATOR, ';'), 8));
}
}
代码示例来源:origin: cpesch/RouteConverter
hdop + SEPARATOR +
vdop + SEPARATOR +
fillWithZeros(escape(description, SEPARATOR, ';'), 8));
代码示例来源:origin: cpesch/RouteConverter
protected void writePosition(NmeaPosition position, PrintWriter writer) {
ValueAndOrientation longitudeAsValueAndOrientation = position.getLongitudeAsValueAndOrientation();
String longitude = formatLongitude(longitudeAsValueAndOrientation.getValue());
String westOrEast = longitudeAsValueAndOrientation.getOrientation().value();
ValueAndOrientation latitudeAsValueAndOrientation = position.getLatitudeAsValueAndOrientation();
String latitude = formatLatitude(latitudeAsValueAndOrientation.getValue());
String northOrSouth = latitudeAsValueAndOrientation.getOrientation().value();
String description = escape(position.getDescription(), SEPARATOR, ';');
String time = formatTime(position.getTime());
String date = formatDate(position.getTime());
String altitude = formatAltitude(position.getElevation());
String trk = "PMGNTRK" + SEPARATOR +
latitude + SEPARATOR + northOrSouth + SEPARATOR + longitude + SEPARATOR + westOrEast + SEPARATOR +
altitude + SEPARATOR + "M" + SEPARATOR + time + SEPARATOR + "A" + SEPARATOR +
description + SEPARATOR + date;
writeSentence(writer, trk);
}
代码示例来源:origin: cpesch/RouteConverter
String northOrSouth = latitudeAsValueAndOrientation.getOrientation().value();
String satellites = position.getSatellites() != null ? formatIntAsString(position.getSatellites()) : "";
String description = escape(position.getDescription(), SEPARATOR, ';');
String time = formatTime(position.getTime());
String date = formatDate(position.getTime());
内容来源于网络,如有侵权,请联系作者删除!