Here you can find the source of startsWithURIScheme(String arg)
public static boolean startsWithURIScheme(String arg)
//package com.java2s; /* // w w w.j a v a 2s . c om Copyright 2007-2014 Fraunhofer IGD, http://www.igd.fraunhofer.de Fraunhofer-Gesellschaft - Institute for Computer Graphics Research See the NOTICE file distributed with this work for additional information regarding copyright ownership Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ public class Main { /** * Determines if a prefix of the specified String is conform to an URI * definition. The following conditions are checked: * <ul> * <li>the String starts with a letter ([a-z,A-Z])</li> * <li>the String contains the symbol ':'</li> * <li>all characters from the beginning to the symbol ':' are either a * letter, a digit, or one of [+, -, .]</li> * </ul> */ public static boolean startsWithURIScheme(String arg) { if (arg == null || arg.length() == 0) return false; char c = arg.charAt(0); int i = arg.indexOf(':'); if (i < 1 || !isAsciiLetter(c)) return false; while (--i > 0) { c = arg.charAt(i); if (!isAsciiLetter(c) && !isDigit(c) && c != '+' && c != '-' && c != '.') return false; } return true; } /** Determines if the specified character is a letter [a-z,A-Z]. */ public static boolean isAsciiLetter(char c) { return (c >= 'A' && c <= 'Z') || (c <= 'z' && c >= 'a'); } /** Determines if the specified character is a digit [0-9]. */ public static boolean isDigit(char c) { return c >= '0' && c <= '9'; } }