Tabnine Logo
String.subSequence
Code IndexAdd Tabnine to your IDE (free)

How to use
subSequence
method
in
java.lang.String

Best Java code snippets using java.lang.String.subSequence (Showing top 20 results out of 5,157)

origin: org.assertj/assertj-core

@Override
public CharSequence subSequence(int start, int end) {
 return string.subSequence(start, end);
}
origin: immutables/immutables

 @Override
 public CharSequence subSequence(int start, int end) {
  return string.subSequence(start, end);
 }
}
origin: google/guava

@Override
public CharSequence subSequence(int start, int end) {
 return "foo".subSequence(start, end);
}
origin: AsyncHttpClient/async-http-client

 public static CharSequence filterOutBrotliFromAcceptEncoding(String acceptEncoding) {
  // we don't support Brotly ATM
  if (acceptEncoding.endsWith(BROTLY_ACCEPT_ENCODING_SUFFIX)) {
   return acceptEncoding.subSequence(0, acceptEncoding.length() - BROTLY_ACCEPT_ENCODING_SUFFIX.length());
  }
  return acceptEncoding;
 }
}
origin: org.apache.commons/commons-lang3

@Override
public CharSequence subSequence(final int arg0, final int arg1) {
  return value.subSequence(arg0, arg1);
}
origin: redisson/redisson

@Override
public CharSequence subSequence(int start, int end) {
  return toString().subSequence(start, end);
}
origin: redisson/redisson

@Override
public CharSequence subSequence(int start, int end) {
  return toString().subSequence(start, end);
}
origin: checkstyle/checkstyle

/**
 * Get LineColumn from string till index.
 * @param source Source string.
 * @param index An index into the string.
 * @return A position in the source representing what line and column that index appears on.
 */
private static LineColumn getLineColumnOfIndex(String source, int index) {
  final String precedingText = source.subSequence(0, index).toString();
  final String[] precedingLines = NEWLINE_PATTERN.split(precedingText);
  final String lastLine = precedingLines[precedingLines.length - 1];
  return new LineColumn(precedingLines.length, lastLine.length());
}
origin: robolectric/robolectric

@Override
public CharSequence subSequence(int start, int end) {
 return s.subSequence(start, end);
}
origin: google/error-prone

@Override
public CharSequence subSequence(int beginIndex, int endIndex) {
 return contents().subSequence(beginIndex, endIndex);
}
origin: siacs/Conversations

@Override
public final CharSequence subSequence(int start, int end) {
  return toString().subSequence(start, end);
}
origin: org.apache.logging.log4j/log4j-core

@Override
public CharSequence subSequence(final int start, final int end) {
  return seq.subSequence(start, end);
}
origin: apache/incubator-dubbo

public static Object parseMockValue(String mock, Type[] returnTypes) throws Exception {
  Object value = null;
  if ("empty".equals(mock)) {
    value = ReflectUtils.getEmptyObject(returnTypes != null && returnTypes.length > 0 ? (Class<?>) returnTypes[0] : null);
  } else if ("null".equals(mock)) {
    value = null;
  } else if ("true".equals(mock)) {
    value = true;
  } else if ("false".equals(mock)) {
    value = false;
  } else if (mock.length() >= 2 && (mock.startsWith("\"") && mock.endsWith("\"")
      || mock.startsWith("\'") && mock.endsWith("\'"))) {
    value = mock.subSequence(1, mock.length() - 1);
  } else if (returnTypes != null && returnTypes.length > 0 && returnTypes[0] == String.class) {
    value = mock;
  } else if (StringUtils.isNumeric(mock)) {
    value = JSON.parse(mock);
  } else if (mock.startsWith("{")) {
    value = JSON.parseObject(mock, Map.class);
  } else if (mock.startsWith("[")) {
    value = JSON.parseObject(mock, List.class);
  } else {
    value = mock;
  }
  if (ArrayUtils.isNotEmpty(returnTypes)) {
    value = PojoUtils.realize(value, (Class<?>) returnTypes[0], returnTypes.length > 1 ? returnTypes[1] : null);
  }
  return value;
}
origin: apache/incubator-dubbo

public static Object parseMockValue(String mock, Type[] returnTypes) throws Exception {
  Object value = null;
  if ("empty".equals(mock)) {
    value = ReflectUtils.getEmptyObject(returnTypes != null && returnTypes.length > 0 ? (Class<?>) returnTypes[0] : null);
  } else if ("null".equals(mock)) {
    value = null;
  } else if ("true".equals(mock)) {
    value = true;
  } else if ("false".equals(mock)) {
    value = false;
  } else if (mock.length() >= 2 && (mock.startsWith("\"") && mock.endsWith("\"")
      || mock.startsWith("\'") && mock.endsWith("\'"))) {
    value = mock.subSequence(1, mock.length() - 1);
  } else if (returnTypes != null && returnTypes.length > 0 && returnTypes[0] == String.class) {
    value = mock;
  } else if (StringUtils.isNumeric(mock)) {
    value = JSON.parse(mock);
  } else if (mock.startsWith("{")) {
    value = JSON.parseObject(mock, Map.class);
  } else if (mock.startsWith("[")) {
    value = JSON.parseObject(mock, List.class);
  } else {
    value = mock;
  }
  if (ArrayUtils.isNotEmpty(returnTypes)) {
    value = PojoUtils.realize(value, (Class<?>) returnTypes[0], returnTypes.length > 1 ? returnTypes[1] : null);
  }
  return value;
}
origin: gocd/gocd

boolean isVersionOnedotSixOrHigher(String hgout) {
  String hgVersion = parseGitVersion(hgout);
  Float aFloat = NumberUtils.createFloat(hgVersion.subSequence(0, 3).toString());
  return aFloat >= 1.6;
}
origin: gocd/gocd

boolean isVersionOnedotZeorOrHigher(String hgout) {
  String hgVersion = parseHgVersion(hgout);
  Float aFloat = NumberUtils.createFloat(hgVersion.subSequence(0, 3).toString());
  return aFloat >= 1;
}
origin: SonarSource/sonarqube

 private static void checkDbIdentifierCharacters(String identifier, String identifierDesc) {
  checkArgument(identifier.length() > 0, "Identifier must not be empty");
  checkArgument(
   LOWER_CASE_ASCII_LETTERS_CHAR_MATCHER.or(DIGIT_CHAR_MATCHER).or(anyOf("_")).matchesAllOf(identifier),
   "%s must be lower case and contain only alphanumeric chars or '_', got '%s'", identifierDesc, identifier);
  checkArgument(
   DIGIT_CHAR_MATCHER.or(UNDERSCORE_CHAR_MATCHER).matchesNoneOf(identifier.subSequence(0, 1)),
   "%s must not start by a number or '_', got '%s'", identifierDesc, identifier);
 }
}
origin: commons-codec/commons-codec

  @Test
  public void testSpeedCheck3() throws EncoderException {
    final BeiderMorseEncoder bmpm = this.createGenericApproxEncoder();
    final String phrase = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";

    for (int i = 1; i <= phrase.length(); i++) {
      bmpm.encode(phrase.subSequence(0, i));
    }
  }
}
origin: commons-codec/commons-codec

@Test
public void testSpeedCheck2() throws EncoderException {
  final BeiderMorseEncoder bmpm = this.createGenericApproxEncoder();
  final String phrase = "ItstheendoftheworldasweknowitandIfeelfine";
  for (int i = 1; i <= phrase.length(); i++) {
    bmpm.encode(phrase.subSequence(0, i));
  }
}
origin: robolectric/robolectric

@Test
public void givenInitializingWithAttributeSet_whenMaxLengthDefined_thenRestrictTextLengthToMaxLength() {
 int maxLength = anyInteger();
 AttributeSet attrs = Robolectric.buildAttributeSet()
   .addAttribute(android.R.attr.maxLength, maxLength + "")
   .build();
 EditText editText = new EditText(context, attrs);
 String excessiveInput = stringOfLength(maxLength * 2);
 editText.setText(excessiveInput);
 assertThat((CharSequence) editText.getText().toString()).isEqualTo(excessiveInput.subSequence(0, maxLength));
}
java.langStringsubSequence

Javadoc

Returns a new character sequence that is a subsequence of this sequence.

An invocation of this method of the form

 
str.subSequence(begin, end)
behaves in exactly the same way as the invocation
 
str.substring(begin, end)
This method is defined so that the String class can implement the CharSequence interface.

Popular methods of String

  • equals
  • length
    Returns the number of characters in this string.
  • substring
    Returns a string containing a subsequence of characters from this string. The returned string shares
  • startsWith
    Compares the specified string to this string, starting at the specified offset, to determine if the
  • format
    Returns a formatted string, using the supplied format and arguments, localized to the given locale.
  • split
    Splits this string using the supplied regularExpression. See Pattern#split(CharSequence,int) for an
  • trim
  • valueOf
    Creates a new string containing the specified characters in the character array. Modifying the chara
  • indexOf
  • endsWith
    Compares the specified string to this string to determine if the specified string is a suffix.
  • toLowerCase
    Converts this string to lower case, using the rules of locale.Most case mappings are unaffected by t
  • contains
    Determines if this String contains the sequence of characters in the CharSequence passed.
  • toLowerCase,
  • contains,
  • getBytes,
  • <init>,
  • equalsIgnoreCase,
  • replace,
  • isEmpty,
  • charAt,
  • hashCode,
  • lastIndexOf

Popular in Java

  • Making http requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Socket (java.net)
    Provides a client-side TCP socket.
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Top plugins for WebStorm
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