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

How to use
startsWith
method
in
java.lang.String

Best Java code snippets using java.lang.String.startsWith (Showing top 20 results out of 229,878)

origin: square/okhttp

private static String secondaryName(String javaName) {
 if (javaName.startsWith("TLS_")) {
  return "SSL_" + javaName.substring(4);
 } else if (javaName.startsWith("SSL_")) {
  return "TLS_" + javaName.substring(4);
 } else {
  return javaName;
 }
}
origin: square/okhttp

public Builder path(String path) {
 if (!path.startsWith("/")) throw new IllegalArgumentException("path must start with '/'");
 this.path = path;
 return this;
}
origin: spring-projects/spring-framework

private int skipSeparator(String path, int pos, String separator) {
  int skipped = 0;
  while (path.startsWith(separator, pos + skipped)) {
    skipped += separator.length();
  }
  return skipped;
}
origin: google/guava

private static byte parseOctet(String ipPart) {
 // Note: we already verified that this string contains only hex digits.
 int octet = Integer.parseInt(ipPart);
 // Disallow leading zeroes, because no clear standard exists on
 // whether these should be interpreted as decimal or octal.
 if (octet > 255 || (ipPart.startsWith("0") && ipPart.length() > 1)) {
  throw new NumberFormatException();
 }
 return (byte) octet;
}
origin: stackoverflow.com

 String contentType = connection.getHeaderField("Content-Type");
String charset = null;

for (String param : contentType.replace(" ", "").split(";")) {
  if (param.startsWith("charset=")) {
    charset = param.split("=", 2)[1];
    break;
  }
}

if (charset != null) {
  try (BufferedReader reader = new BufferedReader(new InputStreamReader(response, charset))) {
    for (String line; (line = reader.readLine()) != null;) {
      // ... System.out.println(line) ?
    }
  }
} else {
  // It's likely binary content, use InputStream/OutputStream.
}
origin: spring-projects/spring-framework

/**
 * Indicates whether or not a particular bean name is present in the excluded beans list.
 */
private boolean isExcluded(String beanName) {
  return (this.excludedBeans.contains(beanName) ||
        (beanName.startsWith(BeanFactory.FACTORY_BEAN_PREFIX) &&
            this.excludedBeans.contains(beanName.substring(BeanFactory.FACTORY_BEAN_PREFIX.length()))));
}
origin: square/okhttp

boolean matches(String hostname) {
 if (pattern.startsWith(WILDCARD)) {
  int firstDot = hostname.indexOf('.');
  return (hostname.length() - firstDot - 1) == canonicalHostname.length()
    && hostname.regionMatches(false, firstDot + 1, canonicalHostname, 0,
    canonicalHostname.length());
 }
 return hostname.equals(canonicalHostname);
}
origin: square/okhttp

 @Override public void deleteContents(File directory) throws IOException {
  String prefix = directory.toString() + "/";
  for (Iterator<File> i = files.keySet().iterator(); i.hasNext(); ) {
   File file = i.next();
   if (file.toString().startsWith(prefix)) i.remove();
  }
 }
}
origin: stackoverflow.com

 private static String getSubmittedFileName(Part part) {
  for (String cd : part.getHeader("content-disposition").split(";")) {
    if (cd.trim().startsWith("filename")) {
      String fileName = cd.substring(cd.indexOf('=') + 1).trim().replace("\"", "");
      return fileName.substring(fileName.lastIndexOf('/') + 1).substring(fileName.lastIndexOf('\\') + 1); // MSIE fix.
    }
  }
  return null;
}
origin: square/okhttp

 @FromJson HttpUrl urlFromJson(String urlString) {
  if (urlString.startsWith("wss:")) urlString = "https:" + urlString.substring(4);
  if (urlString.startsWith("ws:")) urlString = "http:" + urlString.substring(3);
  return HttpUrl.get(urlString);
 }
}
origin: square/okhttp

public Builder encodedPath(String encodedPath) {
 if (encodedPath == null) throw new NullPointerException("encodedPath == null");
 if (!encodedPath.startsWith("/")) {
  throw new IllegalArgumentException("unexpected encodedPath: " + encodedPath);
 }
 resolvePath(encodedPath, 0, encodedPath.length());
 return this;
}
origin: square/okhttp

private static boolean pathMatch(HttpUrl url, String path) {
 String urlPath = url.encodedPath();
 if (urlPath.equals(path)) {
  return true; // As in '/foo' matching '/foo'.
 }
 if (urlPath.startsWith(path)) {
  if (path.endsWith("/")) return true; // As in '/' matching '/foo'.
  if (urlPath.charAt(path.length()) == '/') return true; // As in '/foo' matching '/foo/bar'.
 }
 return false;
}
origin: google/guava

/**
 * Identifies just enterIfXxx methods (a subset of {@link #isAnyEnter}), which are mostly like the
 * enterXxx methods but behave like tryEnterXxx in some scenarios.
 */
private static boolean isEnterIf(Method method) {
 return method.getName().startsWith("enterIf");
}
origin: ReactiveX/RxJava

  @Override
  public String apply(Integer t) {
    assertTrue(Thread.currentThread().getName().startsWith("RxCachedThreadScheduler"));
    return "Value_" + t + "_Thread_" + Thread.currentThread().getName();
  }
});
origin: ReactiveX/RxJava

  @Override
  public String apply(Integer t) {
    assertTrue(Thread.currentThread().getName().startsWith("RxComputationThreadPool"));
    return "Value_" + t + "_Thread_" + Thread.currentThread().getName();
  }
});
origin: google/guava

 /**
  * These tests fail in JDK 9 and JDK 10 for an unknown reason. It might be the test; it might be
  * the underlying functionality. Fixing this is not a high priority; if you need it to be fixed,
  * please comment on <a href="https://github.com/google/guava/issues/3086">issue 3086</a>.
  */
 private static boolean isJdk9OrHigher() {
  return JAVA_SPECIFICATION_VERSION.value().startsWith("9")
    || JAVA_SPECIFICATION_VERSION.value().startsWith("10");
 }
}
origin: ReactiveX/RxJava

  @Override
  public String apply(Integer t) {
    assertFalse(Thread.currentThread().getName().equals(currentThreadName));
    assertTrue(Thread.currentThread().getName().startsWith("RxComputationThreadPool"));
    return "Value_" + t + "_Thread_" + Thread.currentThread().getName();
  }
});
origin: ReactiveX/RxJava

@Before
public void before() {
  stringSubscriber = TestHelper.mockSubscriber();
  for (Thread t : Thread.getAllStackTraces().keySet()) {
    if (t.getName().startsWith("RxNewThread")) {
      count++;
    }
  }
}
origin: ReactiveX/RxJava

@Before
public void before() {
  stringObserver = TestHelper.mockObserver();
  for (Thread t : Thread.getAllStackTraces().keySet()) {
    if (t.getName().startsWith("RxNewThread")) {
      count++;
    }
  }
}
origin: ReactiveX/RxJava

@Test(timeout = 5000)
public void subscribeOnNormal() {
  final AtomicReference<String> name = new  AtomicReference<String>();
  Completable c = Completable.unsafeCreate(new CompletableSource() {
    @Override
    public void subscribe(CompletableObserver observer) {
      name.set(Thread.currentThread().getName());
      EmptyDisposable.complete(observer);
    }
  }).subscribeOn(Schedulers.computation());
  c.blockingAwait();
  Assert.assertTrue(name.get().startsWith("RxComputation"));
}
java.langStringstartsWith

Javadoc

Tests if this string starts with the specified prefix.

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
  • 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.
  • getBytes
  • 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
  • From CI to AI: The AI layer in your organization
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