Tabnine Logo
StringBuilder.charAt
Code IndexAdd Tabnine to your IDE (free)

How to use
charAt
method
in
java.lang.StringBuilder

Best Java code snippets using java.lang.StringBuilder.charAt (Showing top 20 results out of 17,784)

origin: alibaba/druid

public static long fnv1a_64_lower(StringBuilder key) {
  long hashCode = BASIC;
  for (int i = 0; i < key.length(); ++i) {
    char ch = key.charAt(i);
    if (ch >= 'A' && ch <= 'Z') {
      ch = (char) (ch + 32);
    }
    hashCode ^= ch;
    hashCode *= PRIME;
  }
  return hashCode;
}
origin: alibaba/druid

public static long fnv1a_64_lower(long basic, StringBuilder key) {
  long hashCode = basic;
  for (int i = 0; i < key.length(); ++i) {
    char ch = key.charAt(i);
    if (ch >= 'A' && ch <= 'Z') {
      ch = (char) (ch + 32);
    }
    hashCode ^= ch;
    hashCode *= PRIME;
  }
  return hashCode;
}
origin: spring-projects/spring-framework

public void removeTrailingSlash() {
  int index = this.path.length() - 1;
  if (this.path.charAt(index) == '/') {
    this.path.deleteCharAt(index);
  }
}
origin: ReactiveX/RxJava

public static int lineNumber(StringBuilder s, int index) {
  int cnt = 1;
  for (int i = 0; i < index; i++) {
    if (s.charAt(i) == '\n') {
      cnt++;
    }
  }
  return cnt;
}
origin: org.apache.commons/commons-lang3

private static void convertRemainingAccentCharacters(final StringBuilder decomposed) {
  for (int i = 0; i < decomposed.length(); i++) {
    if (decomposed.charAt(i) == '\u0141') {
      decomposed.deleteCharAt(i);
      decomposed.insert(i, 'L');
    } else if (decomposed.charAt(i) == '\u0142') {
      decomposed.deleteCharAt(i);
      decomposed.insert(i, 'l');
    }
  }
}
origin: redisson/redisson

@Override
public char lastChar() {
  if ( builder.length() > 0 ) {
    return builder.charAt(builder.length()-1);
  }
  return 0;
}
origin: greenrobot/greenDAO

public static String dbName(String javaName) {
  StringBuilder builder = new StringBuilder(javaName);
  for (int i = 1; i < builder.length(); i++) {
    boolean lastWasUpper = Character.isUpperCase(builder.charAt(i - 1));
    boolean isUpper = Character.isUpperCase(builder.charAt(i));
    if (isUpper && !lastWasUpper) {
      builder.insert(i, '_');
      i++;
    }
  }
  return builder.toString().toUpperCase();
}
origin: spring-projects/spring-framework

/**
 * Trim all occurrences of the supplied leading character from the given {@code String}.
 * @param str the {@code String} to check
 * @param leadingCharacter the leading character to be trimmed
 * @return the trimmed {@code String}
 */
public static String trimLeadingCharacter(String str, char leadingCharacter) {
  if (!hasLength(str)) {
    return str;
  }
  StringBuilder sb = new StringBuilder(str);
  while (sb.length() > 0 && sb.charAt(0) == leadingCharacter) {
    sb.deleteCharAt(0);
  }
  return sb.toString();
}
origin: spring-projects/spring-framework

/**
 * Trim leading whitespace from the given {@code String}.
 * @param str the {@code String} to check
 * @return the trimmed {@code String}
 * @see java.lang.Character#isWhitespace
 */
public static String trimLeadingWhitespace(String str) {
  if (!hasLength(str)) {
    return str;
  }
  StringBuilder sb = new StringBuilder(str);
  while (sb.length() > 0 && Character.isWhitespace(sb.charAt(0))) {
    sb.deleteCharAt(0);
  }
  return sb.toString();
}
origin: spring-projects/spring-framework

/**
 * Trim all occurrences of the supplied trailing character from the given {@code String}.
 * @param str the {@code String} to check
 * @param trailingCharacter the trailing character to be trimmed
 * @return the trimmed {@code String}
 */
public static String trimTrailingCharacter(String str, char trailingCharacter) {
  if (!hasLength(str)) {
    return str;
  }
  StringBuilder sb = new StringBuilder(str);
  while (sb.length() > 0 && sb.charAt(sb.length() - 1) == trailingCharacter) {
    sb.deleteCharAt(sb.length() - 1);
  }
  return sb.toString();
}
origin: spring-projects/spring-framework

/**
 * Trim trailing whitespace from the given {@code String}.
 * @param str the {@code String} to check
 * @return the trimmed {@code String}
 * @see java.lang.Character#isWhitespace
 */
public static String trimTrailingWhitespace(String str) {
  if (!hasLength(str)) {
    return str;
  }
  StringBuilder sb = new StringBuilder(str);
  while (sb.length() > 0 && Character.isWhitespace(sb.charAt(sb.length() - 1))) {
    sb.deleteCharAt(sb.length() - 1);
  }
  return sb.toString();
}
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: 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: apache/incubator-dubbo

private static String toKey(String prefix, String id) {
  StringBuilder sb = new StringBuilder();
  if (StringUtils.isNotEmpty(prefix)) {
    sb.append(prefix);
  }
  if (StringUtils.isNotEmpty(id)) {
    sb.append(id);
  }
  if (sb.length() > 0 && sb.charAt(sb.length() - 1) != '.') {
    sb.append(".");
  }
  if (sb.length() > 0) {
    return sb.toString();
  }
  return Constants.DUBBO;
}
origin: apache/incubator-dubbo

private static String toKey(String prefix, String id) {
  StringBuilder sb = new StringBuilder();
  if (StringUtils.isNotEmpty(prefix)) {
    sb.append(prefix);
  }
  if (StringUtils.isNotEmpty(id)) {
    sb.append(id);
  }
  if (sb.length() > 0 && sb.charAt(sb.length() - 1) != '.') {
    sb.append(".");
  }
  if (sb.length() > 0) {
    return sb.toString();
  }
  return Constants.DUBBO;
}
origin: prestodb/presto

@Override
public void encodeValueInto(int depth, Block block, int position, SliceOutput output)
{
  float value = Float.intBitsToFloat((int) type.getLong(block, position));
  buffer.setLength(0);
  buffer.append(value);
  for (int index = 0; index < buffer.length(); index++) {
    output.writeByte(buffer.charAt(index));
  }
}
origin: prestodb/presto

@Override
public void encodeValueInto(int depth, Block block, int position, SliceOutput output)
{
  long value = type.getLong(block, position);
  buffer.setLength(0);
  buffer.append(value);
  for (int index = 0; index < buffer.length(); index++) {
    output.writeByte(buffer.charAt(index));
  }
}
origin: prestodb/presto

private void encodeValue(Block block, int position, SliceOutput output)
{
  double value = type.getDouble(block, position);
  buffer.setLength(0);
  buffer.append(value);
  for (int index = 0; index < buffer.length(); index++) {
    output.writeByte(buffer.charAt(index));
  }
}
origin: prestodb/presto

private void encodeValue(Block block, int position, SliceOutput output)
{
  long days = type.getLong(block, position);
  long millis = TimeUnit.DAYS.toMillis(days);
  buffer.setLength(0);
  HIVE_DATE_PARSER.printTo(buffer, millis);
  for (int index = 0; index < buffer.length(); index++) {
    output.writeByte(buffer.charAt(index));
  }
}
origin: prestodb/presto

@Override
public void encodeValueInto(int depth, Block block, int position, SliceOutput output)
{
  long millis = type.getLong(block, position);
  buffer.setLength(0);
  dateTimeFormatter.printTo(buffer, millis);
  for (int index = 0; index < buffer.length(); index++) {
    output.writeByte(buffer.charAt(index));
  }
}
java.langStringBuildercharAt

Popular methods of StringBuilder

  • append
  • toString
  • <init>
    Constructs a string builder initialized to the contents of the specified string. The initial capacit
  • length
  • setLength
  • deleteCharAt
  • insert
  • substring
  • delete
  • replace
  • setCharAt
  • indexOf
  • setCharAt,
  • indexOf,
  • lastIndexOf,
  • reverse,
  • appendCodePoint,
  • getChars,
  • subSequence,
  • ensureCapacity,
  • trimToSize

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • getSupportFragmentManager (FragmentActivity)
  • notifyDataSetChanged (ArrayAdapter)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • JLabel (javax.swing)
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now