本文整理汇总了Java中org.apache.commons.lang3.StringUtils.stripEnd方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.stripEnd方法的具体用法?Java StringUtils.stripEnd怎么用?Java StringUtils.stripEnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.StringUtils
的用法示例。
在下文中一共展示了StringUtils.stripEnd方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseFieldName
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private String parseFieldName(final String line, final int colonIndex, final boolean request)
throws InvalidHttpHeaderException {
String name = line.substring(0, colonIndex).toLowerCase(Locale.ENGLISH);
if (name.isEmpty()) {
throw new InvalidHttpHeaderException("Invalid HTTP header field: Empty header field name.");
}
if (Character.isWhitespace(name.charAt(name.length() - 1))) {
if (request) {
throw new InvalidHttpHeaderException("Invalid HTTP header field: "
+ "No whitespace is allowed between the header field-name and colon.");
} else {
name = StringUtils.stripEnd(name, null);
}
}
return name;
}
示例2: getRawJavaSnippet
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static String getRawJavaSnippet(final Class<?> clazz, final String modulePath, final String marker, final String start, final String end) {
String javaCode = getRawJava(clazz.getName(), modulePath);
final int markerIndex = javaCode.indexOf(marker);
if (markerIndex < 0) {
throw new IllegalArgumentException("Cannot find java snippet for: " + clazz.getName() + " " + marker);
}
javaCode = javaCode.substring(markerIndex);
javaCode = javaCode.substring(javaCode.indexOf(start) + start.length());
javaCode = javaCode.substring(0, javaCode.indexOf(end));
javaCode = StringUtils.stripEnd(javaCode, " " + NEW_LINE);
// Remove indentation
final String trimmedJavaCode = javaCode.trim();
final int leadingSpaces = javaCode.indexOf(trimmedJavaCode);
if (leadingSpaces > 0) {
final String spacesRegex = NEW_LINE + StringUtils.repeat(" ", leadingSpaces);
javaCode = trimmedJavaCode.replace(spacesRegex, NEW_LINE);
}
return javaCode;
}
示例3: guessServerUrl
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public String guessServerUrl() {
String hostName;
try {
hostName = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
throw new RuntimeException(e);
}
String serverUrl;
if (serverConfig.getHttpPort() != 0)
serverUrl = "http://" + hostName + ":" + serverConfig.getHttpPort();
else
serverUrl = "https://" + hostName + ":" + serverConfig.getSslConfig().getPort();
return StringUtils.stripEnd(serverUrl, "/");
}
示例4: trimSlash
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* SQL文末尾の"/"を取り除く<br>
*
* @param sql SQL文字列
* @return トリム後文字列
*/
private String trimSlash(final String sql) {
String trimedSql = sql.trim();
if (trimedSql.endsWith(PATH_SEPARATOR) && !trimedSql.endsWith("*/")) {
return StringUtils.stripEnd(trimedSql, PATH_SEPARATOR);
} else {
return sql;
}
}
示例5: toString
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append(commit.getHash()).append(": ");
for (Range range: ranges)
builder.append(range).append(", ");
return StringUtils.stripEnd(builder.toString(), ", ");
}
示例6: FrameTask
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public FrameTask() {
file = StringUtils.stripEnd(getfileName(), ".java") + file;
initFields(true, getFile());
}
示例7: CpuTask
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public CpuTask() {
file = StringUtils.stripEnd(getfileName(), ".java") + file;
initFields(true, getFile());
}
示例8: isValid
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public boolean isValid(ConstraintValidatorContext context) {
if (serverUrl != null)
serverUrl = StringUtils.stripEnd(serverUrl, "/\\");
return true;
}
示例9: FlowTask
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public FlowTask() {
String fileName = Thread.currentThread().getStackTrace()[2].getFileName();
file = StringUtils.stripEnd(fileName, ".java") + file;
initFields(true, getFile());
}
示例10: MemTask
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public MemTask() {
file = StringUtils.stripEnd(getfileName(), ".java") + file;
initFields(true, getFile());
}
示例11: ForgerockUserDao2
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public ForgerockUserDao2(String serverUrl, String serverUsername, String serverPassword) {
this.serverUrl = StringUtils.stripEnd(serverUrl, "/");
this.serverUsername = serverUsername;
this.serverPassword = serverPassword;
}
示例12: iteration
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
protected boolean iteration(InteractiveModeConsole reader, ScriptKnowledgeBaseInterpreter scriptInterpreter) throws IOException {
StringBuffer commandBuffer = new StringBuffer();
while (true) {
if (!engine.isRunning()) {
return false;
}
String command = null;
try {
command = reader.readLine();
} catch (IOException e) {
handleException("readLine", e);
return false;
}
if (command == null) {
return false;
}
command = StringUtils.stripEnd(command, null);
if (StringUtils.equalsAny(command.trim(), InteractiveModeConstants.EXIT_COMMAND, InteractiveModeConstants.QUIT_COMMAND)) {
return false;
}
boolean isMultiLineStatement = command.endsWith(InteractiveModeConstants.LINE_BREAK);
if (isMultiLineStatement) {
command = StringUtils.removeEnd(command, InteractiveModeConstants.LINE_BREAK);
}
commandBuffer.append(command);
if (isMultiLineStatement) {
commandBuffer.append(System.lineSeparator());
} else {
break;
}
}
if (engine.isRunning()) {
scriptInterpreter.eval(commandBuffer.toString());
return true;
} else {
return false;
}
}