本文整理了Java中java.lang.StringBuilder.delete()
方法的一些代码示例,展示了StringBuilder.delete()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StringBuilder.delete()
方法的具体详情如下:
包路径:java.lang.StringBuilder
类名称:StringBuilder
方法名:delete
[英]Deletes a sequence of characters specified by start and end. Shifts any remaining characters to the left.
[中]删除由开始和结束指定的字符序列。将所有剩余字符向左移动。
代码示例来源:origin: spring-projects/spring-framework
private void clear(StringBuilder sb) {
sb.delete(0, sb.length());
}
}
代码示例来源:origin: skylot/jadx
private void removeFirstEmptyLine() {
int len = NL.length();
if (buf.substring(0, len).equals(NL)) {
buf.delete(0, len);
}
}
代码示例来源:origin: libgdx/libgdx
private void flushBuilder() {
if (mBuilder.length() > 0) {
Log.v("GLSurfaceView", mBuilder.toString());
mBuilder.delete(0, mBuilder.length());
}
}
代码示例来源:origin: libgdx/libgdx
private void flushBuilder() {
if (mBuilder.length() > 0) {
Log.v("GLSurfaceView", mBuilder.toString());
mBuilder.delete(0, mBuilder.length());
}
}
代码示例来源:origin: lets-blade/blade
private static StringBuilder clearLastComma(StringBuilder buff) {
int lastComma = buff.lastIndexOf(", ");
// No comma found, take everything
if (-1 != lastComma)
buff.delete(lastComma, buff.length());
return buff;
}
代码示例来源:origin: lets-blade/blade
private static StringBuilder clearLastComma(StringBuilder buff) {
int lastComma = buff.lastIndexOf(", ");
// No comma found, take everything
if (-1 != lastComma)
buff.delete(lastComma, buff.length());
return buff;
}
代码示例来源:origin: square/okhttp
private String headerValue() {
StringBuilder result = new StringBuilder();
if (noCache) result.append("no-cache, ");
if (noStore) result.append("no-store, ");
if (maxAgeSeconds != -1) result.append("max-age=").append(maxAgeSeconds).append(", ");
if (sMaxAgeSeconds != -1) result.append("s-maxage=").append(sMaxAgeSeconds).append(", ");
if (isPrivate) result.append("private, ");
if (isPublic) result.append("public, ");
if (mustRevalidate) result.append("must-revalidate, ");
if (maxStaleSeconds != -1) result.append("max-stale=").append(maxStaleSeconds).append(", ");
if (minFreshSeconds != -1) result.append("min-fresh=").append(minFreshSeconds).append(", ");
if (onlyIfCached) result.append("only-if-cached, ");
if (noTransform) result.append("no-transform, ");
if (immutable) result.append("immutable, ");
if (result.length() == 0) return "";
result.delete(result.length() - 2, result.length());
return result.toString();
}
代码示例来源:origin: lets-blade/blade
private static String takeUntilDotOrEnd(StringBuilder buff) {
final int firstPointIdx = buff.indexOf(".");
String result;
if (-1 == firstPointIdx) {
result = buff.toString();
buff.setLength(0);
} else {
result = buff.substring(0, firstPointIdx);
buff.delete(0, firstPointIdx + 1);
}
return result;
}
代码示例来源:origin: lets-blade/blade
private static String takeUntilDotOrEnd(StringBuilder buff) {
final int firstPointIdx = buff.indexOf(".");
String result;
if (-1 == firstPointIdx) {
result = buff.toString();
buff.setLength(0);
} else {
result = buff.substring(0, firstPointIdx);
buff.delete(0, firstPointIdx + 1);
}
return result;
}
代码示例来源:origin: bumptech/glide
@Override
public String toString() {
StringBuilder sb = new StringBuilder("GroupedLinkedMap( ");
LinkedEntry<K, V> current = head.next;
boolean hadAtLeastOneItem = false;
while (!current.equals(head)) {
hadAtLeastOneItem = true;
sb.append('{').append(current.key).append(':').append(current.size()).append("}, ");
current = current.next;
}
if (hadAtLeastOneItem) {
sb.delete(sb.length() - 2, sb.length());
}
return sb.append(" )").toString();
}
代码示例来源:origin: pockethub/PocketHub
private static StringBuilder strip(final StringBuilder input,
final String prefix, final String suffix) {
int start = input.indexOf(prefix);
while (start != -1) {
int end = input.indexOf(suffix, start + prefix.length());
if (end == -1) {
end = input.length();
}
input.delete(start, end + suffix.length());
start = input.indexOf(prefix, start);
}
return input;
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Append the query string of the current request to the target redirect URL.
* @param targetUrl the StringBuilder to append the properties to
* @param request the current request
* @since 4.1
*/
protected void appendCurrentQueryParams(StringBuilder targetUrl, HttpServletRequest request) {
String query = request.getQueryString();
if (StringUtils.hasText(query)) {
// Extract anchor fragment, if any.
String fragment = null;
int anchorIndex = targetUrl.indexOf("#");
if (anchorIndex > -1) {
fragment = targetUrl.substring(anchorIndex);
targetUrl.delete(anchorIndex, targetUrl.length());
}
if (targetUrl.toString().indexOf('?') < 0) {
targetUrl.append('?').append(query);
}
else {
targetUrl.append('&').append(query);
}
// Append anchor fragment, if any, to end of URL.
if (fragment != null) {
targetUrl.append(fragment);
}
}
}
代码示例来源:origin: spring-projects/spring-framework
String key = sb.substring(keyStart + PropertyAccessor.PROPERTY_KEY_PREFIX.length(), keyEnd);
if ((key.startsWith("'") && key.endsWith("'")) || (key.startsWith("\"") && key.endsWith("\""))) {
sb.delete(keyStart + 1, keyStart + 2);
sb.delete(keyEnd - 2, keyEnd - 1);
keyEnd = keyEnd - 2;
代码示例来源:origin: graphql-java/graphql-java
private String joinReasons(List<Conflict> conflicts) {
StringBuilder result = new StringBuilder();
result.append("(");
for (Conflict conflict : conflicts) {
result.append(conflict.reason);
result.append(", ");
}
result.delete(result.length() - 2, result.length());
result.append(")");
return result.toString();
}
代码示例来源:origin: apache/storm
private void logDataPoints(Collection<DataPoint> dataPoints, StringBuilder sb, String header) {
for (DataPoint p : dataPoints) {
sb.delete(header.length(), sb.length());
sb.append(p.getName())
.append(padding).delete(header.length() + 23, sb.length()).append("\t")
.append(p.getValue());
LOG.info(sb.toString());
}
}
}
代码示例来源:origin: prestodb/presto
private String headerValue() {
StringBuilder result = new StringBuilder();
if (noCache) result.append("no-cache, ");
if (noStore) result.append("no-store, ");
if (maxAgeSeconds != -1) result.append("max-age=").append(maxAgeSeconds).append(", ");
if (sMaxAgeSeconds != -1) result.append("s-maxage=").append(sMaxAgeSeconds).append(", ");
if (isPrivate) result.append("private, ");
if (isPublic) result.append("public, ");
if (mustRevalidate) result.append("must-revalidate, ");
if (maxStaleSeconds != -1) result.append("max-stale=").append(maxStaleSeconds).append(", ");
if (minFreshSeconds != -1) result.append("min-fresh=").append(minFreshSeconds).append(", ");
if (onlyIfCached) result.append("only-if-cached, ");
if (noTransform) result.append("no-transform, ");
if (immutable) result.append("immutable, ");
if (result.length() == 0) return "";
result.delete(result.length() - 2, result.length());
return result.toString();
}
代码示例来源:origin: Tencent/tinker
private static String subNodeToString(Node node) {
StringBuilder stringBuilder = new StringBuilder();
if (node != null) {
NodeList nodeList = node.getChildNodes();
stringBuilder.append(nodeToString(node, false));
stringBuilder.append(StringUtil.CRLF_STRING);
int nodeListLength = nodeList.getLength();
for (int i = 0; i < nodeListLength; i++) {
Node childNode = nodeList.item(i);
if (childNode.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
stringBuilder.append(nodeToString(childNode, true));
stringBuilder.append(StringUtil.CRLF_STRING);
}
if (stringBuilder.length() > StringUtil.CRLF_STRING.length()) {
stringBuilder.delete(stringBuilder.length() - StringUtil.CRLF_STRING.length(), stringBuilder.length());
}
}
return stringBuilder.toString();
}
代码示例来源:origin: skylot/jadx
public String test() {
// a chain we can't simplify
return new StringBuilder("[init]").append("a1").delete(1, 2).toString();
}
}
代码示例来源:origin: neo4j/neo4j
@Override
public void clear()
{
builder.delete( 0, builder.length() );
field = 0;
}
代码示例来源:origin: libgdx/libgdx
@Override
protected void render (ModelBatch batch, Array<ModelInstance> instances) {
if(emitters.size > 0){
//Update
float delta = Gdx.graphics.getDeltaTime();
builder.delete(0, builder.length());
builder.append(Gdx.graphics.getFramesPerSecond());
fpsLabel.setText(builder);
ui.act(delta);
billboardParticleBatch.begin();
for (ParticleController controller : emitters){
controller.update();
controller.draw();
}
billboardParticleBatch.end();
batch.render(billboardParticleBatch, environment);
}
batch.render(instances, environment);
ui.draw();
}
}
内容来源于网络,如有侵权,请联系作者删除!