本文整理了Java中java.lang.StringBuilder.setCharAt()
方法的一些代码示例,展示了StringBuilder.setCharAt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StringBuilder.setCharAt()
方法的具体详情如下:
包路径:java.lang.StringBuilder
类名称:StringBuilder
方法名:setCharAt
暂无
代码示例来源:origin: netty/netty
private static void appendHexDumpRowPrefix(StringBuilder dump, int row, int rowStartIndex) {
if (row < HEXDUMP_ROWPREFIXES.length) {
dump.append(HEXDUMP_ROWPREFIXES[row]);
} else {
dump.append(NEWLINE);
dump.append(Long.toHexString(rowStartIndex & 0xFFFFFFFFL | 0x100000000L));
dump.setCharAt(dump.length() - 9, '|');
dump.append('|');
}
}
}
代码示例来源:origin: netty/netty
/**
* Creates a new ephemeral port based on the ID of the specified channel.
* Note that we prepend an upper-case character so that it never conflicts with
* the addresses created by a user, which are always lower-cased on construction time.
*/
LocalAddress(Channel channel) {
StringBuilder buf = new StringBuilder(16);
buf.append("local:E");
buf.append(Long.toHexString(channel.hashCode() & 0xFFFFFFFFL | 0x100000000L));
buf.setCharAt(7, ':');
id = buf.substring(6);
strVal = buf.toString();
}
代码示例来源:origin: prestodb/presto
private static String convertToAsciiNumber(String convId) {
StringBuilder buf = new StringBuilder(convId);
for (int i = 0; i < buf.length(); i++) {
char ch = buf.charAt(i);
int digit = Character.digit(ch, 10);
if (digit >= 0) {
buf.setCharAt(i, (char) ('0' + digit));
}
}
return buf.toString();
}
代码示例来源:origin: netty/netty
@Override
protected StringBuilder toStringBuilder() {
StringBuilder buf = super.toStringBuilder();
buf.setCharAt(buf.length() - 1, ',');
return buf.append(" task: ")
.append(task)
.append(')');
}
}
代码示例来源:origin: netty/netty
@Override
protected StringBuilder toStringBuilder() {
StringBuilder buf = super.toStringBuilder();
buf.setCharAt(buf.length() - 1, ',');
return buf.append(" id: ")
.append(id)
.append(", deadline: ")
.append(deadlineNanos)
.append(", period: ")
.append(periodNanos)
.append(')');
}
代码示例来源:origin: redisson/redisson
private static void appendHexDumpRowPrefix(StringBuilder dump, int row, int rowStartIndex) {
if (row < HEXDUMP_ROWPREFIXES.length) {
dump.append(HEXDUMP_ROWPREFIXES[row]);
} else {
dump.append(NEWLINE);
dump.append(Long.toHexString(rowStartIndex & 0xFFFFFFFFL | 0x100000000L));
dump.setCharAt(dump.length() - 9, '|');
dump.append('|');
}
}
}
代码示例来源:origin: apache/incubator-druid
private void removeLastComma()
{
assert sb.charAt(sb.length() - 2) == ',' && sb.charAt(sb.length() - 1) == '\n';
sb.setCharAt(sb.length() - 2, '\n');
sb.setLength(sb.length() - 1);
}
代码示例来源:origin: redisson/redisson
/**
* Creates a new ephemeral port based on the ID of the specified channel.
* Note that we prepend an upper-case character so that it never conflicts with
* the addresses created by a user, which are always lower-cased on construction time.
*/
LocalAddress(Channel channel) {
StringBuilder buf = new StringBuilder(16);
buf.append("local:E");
buf.append(Long.toHexString(channel.hashCode() & 0xFFFFFFFFL | 0x100000000L));
buf.setCharAt(7, ':');
id = buf.substring(6);
strVal = buf.toString();
}
代码示例来源:origin: joda-time/joda-time
private static String convertToAsciiNumber(String convId) {
StringBuilder buf = new StringBuilder(convId);
for (int i = 0; i < buf.length(); i++) {
char ch = buf.charAt(i);
int digit = Character.digit(ch, 10);
if (digit >= 0) {
buf.setCharAt(i, (char) ('0' + digit));
}
}
return buf.toString();
}
代码示例来源:origin: eclipse-vertx/vert.x
static CharSequence toLowerCase(CharSequence s) {
StringBuilder buffer = null;
int len = s.length();
for (int index = 0; index < len; index++) {
char c = s.charAt(index);
if (c >= 'A' && c <= 'Z') {
if (buffer == null) {
buffer = new StringBuilder(s);
}
buffer.setCharAt(index, (char)(c + ('a' - 'A')));
}
}
if (buffer != null) {
return buffer.toString();
} else {
return s;
}
}
代码示例来源:origin: JodaOrg/joda-time
private static String convertToAsciiNumber(String convId) {
StringBuilder buf = new StringBuilder(convId);
for (int i = 0; i < buf.length(); i++) {
char ch = buf.charAt(i);
int digit = Character.digit(ch, 10);
if (digit >= 0) {
buf.setCharAt(i, (char) ('0' + digit));
}
}
return buf.toString();
}
代码示例来源:origin: redisson/redisson
@Override
protected StringBuilder toStringBuilder() {
StringBuilder buf = super.toStringBuilder();
buf.setCharAt(buf.length() - 1, ',');
return buf.append(" task: ")
.append(task)
.append(')');
}
}
代码示例来源:origin: lets-blade/blade
private void registerRoutePatterns(HttpMethod httpMethod) {
StringBuilder patternBuilder = patternBuilders.get(httpMethod);
if (patternBuilder.length() > 1) {
patternBuilder.setCharAt(patternBuilder.length() - 1, '$');
}
log.debug("Fast Route Method: {}, regex: {}", httpMethod, patternBuilder);
regexRoutePatterns.put(httpMethod, Pattern.compile(patternBuilder.toString()));
}
代码示例来源:origin: lets-blade/blade
private void registerRoutePatterns(HttpMethod httpMethod) {
StringBuilder patternBuilder = patternBuilders.get(httpMethod);
if (patternBuilder.length() > 1) {
patternBuilder.setCharAt(patternBuilder.length() - 1, '$');
}
log.debug("Fast Route Method: {}, regex: {}", httpMethod, patternBuilder);
regexRoutePatterns.put(httpMethod, Pattern.compile(patternBuilder.toString()));
}
代码示例来源:origin: hibernate/hibernate-orm
private static String getJavaAttributeNameFromXMLOne(String attributeName) {
StringBuilder annotationAttributeName = new StringBuilder( attributeName );
int index = annotationAttributeName.indexOf( WORD_SEPARATOR );
while ( index != -1 ) {
annotationAttributeName.deleteCharAt( index );
annotationAttributeName.setCharAt(
index, Character.toUpperCase( annotationAttributeName.charAt( index ) )
);
index = annotationAttributeName.indexOf( WORD_SEPARATOR );
}
return annotationAttributeName.toString();
}
代码示例来源:origin: redisson/redisson
@Override
protected StringBuilder toStringBuilder() {
StringBuilder buf = super.toStringBuilder();
buf.setCharAt(buf.length() - 1, ',');
return buf.append(" id: ")
.append(id)
.append(", deadline: ")
.append(deadlineNanos)
.append(", period: ")
.append(periodNanos)
.append(')');
}
代码示例来源:origin: robolectric/robolectric
private static String replaceLastDotWith$IfInnerStaticClass(String receiverClassName) {
String[] splits = receiverClassName.split("\\.", 0);
String staticInnerClassRegex = "[A-Z][a-zA-Z]*";
if (splits.length > 1
&& splits[splits.length - 1].matches(staticInnerClassRegex)
&& splits[splits.length - 2].matches(staticInnerClassRegex)) {
int lastDotIndex = receiverClassName.lastIndexOf(".");
StringBuilder buffer = new StringBuilder(receiverClassName);
buffer.setCharAt(lastDotIndex, '$');
return buffer.toString();
}
return receiverClassName;
}
代码示例来源:origin: apache/storm
private String getJsonFromTuples(List<? extends ITuple> tuples) throws SolrMapperException {
final StringBuilder jsonListBuilder = new StringBuilder("[");
for (ITuple tuple : tuples) {
final String json = getJsonFromTuple(tuple);
jsonListBuilder.append(json).append(",");
}
jsonListBuilder.setCharAt(jsonListBuilder.length() - 1, ']');
return jsonListBuilder.toString();
}
代码示例来源:origin: facebook/stetho
private static String capitalize(String str) {
if (str == null || str.length() == 0 || Character.isTitleCase(str.charAt(0))) {
return str;
}
StringBuilder buffer = new StringBuilder(str);
buffer.setCharAt(0, Character.toTitleCase(buffer.charAt(0)));
return buffer.toString();
}
代码示例来源:origin: google/error-prone
@Override
public Description matchLiteral(LiteralTree literalTree, VisitorState state) {
if (!matcher.matches(literalTree, state)) {
return Description.NO_MATCH;
}
StringBuilder longLiteral = new StringBuilder(getLongLiteral(literalTree, state));
longLiteral.setCharAt(longLiteral.length() - 1, 'L');
Fix fix = SuggestedFix.replace(literalTree, longLiteral.toString());
return describeMatch(literalTree, fix);
}
}
内容来源于网络,如有侵权,请联系作者删除!