Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {

    public static boolean contains(final String searchableString, final String restriction) {
        int i = 0, j = 0;
        while ((i < restriction.length()) && (j < searchableString.length())) {
            if (restriction.charAt(i) == searchableString.charAt(j)) {
                ++i;
                ++j;
            } else {
                ++j;
            }
        }
        if (i == restriction.length()) {
            return true;
        }
        return false;
    }
}