Java – string prefix match using startsWith

Java String startsWith(String prefix) example:

public class Main {
  public static void main(String[] args) {
    String bigStr = "Hello World";
    String prefix = "Hello W";
OpenJDK 64-Bit Server VM warning: Insufficient space for shared memory file:
Try using the option to select an alternate temp location.

To specify offset use

startsWith(String prefix, int toffset)
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments