Java tutorial
//package com.java2s; /* * Copyright (c) 2012. betterFORM Project - http://www.betterform.de * Licensed under the terms of BSD License */ public class Main { /** * Start of an instance() function expression. */ public static final String INSTANCE_FUNCTION = "instance("; /** * Checks wether the specified path expression starts with the * <code>instance</code> function. * <p/> * Examples: * <ul> * <li><code>"a"</code> returns <code>false</code>. * <li><code>"a[.=instance('i')/b]"</code> returns <code>false</code>. * <li><code>"instance('i')/a"</code> returns <code>true</code>. * <li><code>"instance(/b/c)/a"</code> returns <code>true</code>. * </ul> * * @param path the path expression. * @return <code>true</code> if the specified path expression starts with * the <code>instance</code> function, <code>false</code> otherwise. */ public static boolean hasInstanceFunction(String path) { return path != null && path.startsWith(INSTANCE_FUNCTION); } }