Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.annotation.TargetApi;

import android.os.Build;

import android.util.Patterns;

import java.util.regex.Pattern;

public class Main {
    /**
     * Validate a web url
     * @param webUrl web url to validate
     * @return return true if url is valid otherwise false
     */
    @TargetApi(Build.VERSION_CODES.FROYO)
    public static boolean validateWebURLAsPerAndroid(String webUrl) {
        final Pattern pattern = Patterns.WEB_URL;
        return pattern.matcher(webUrl).matches();
    }
}