/** * Gets everything before the last path component of a path using a given separator. If the * separator cannot be found, the path itself is returned. * <p> * For example, beforeLastPathComponent("foo.bar.baz", '.') would return "foo.bar" and * beforeLastPathComponent("foo", '.') would return "". * * @param path * The path to parse * @param separator * The path separator character * @return Everything before the last component in the path */ public static String beforeLastPathComponent(final String path, final char separator) { return beforeLast(path, separator); }
/** * Gets everything before the last path component of a path using a given separator. If the * separator cannot be found, the path itself is returned. * <p> * For example, beforeLastPathComponent("foo.bar.baz", '.') would return "foo.bar" and * beforeLastPathComponent("foo", '.') would return "". * * @param path * The path to parse * @param separator * The path separator character * @return Everything before the last component in the path */ public static String beforeLastPathComponent(final String path, final char separator) { return beforeLast(path, separator); }
/** * Gets everything before the last path component of a path using a given separator. If the * separator cannot be found, the path itself is returned. * <p> * For example, beforeLastPathComponent("foo.bar.baz", '.') would return "foo.bar" and * beforeLastPathComponent("foo", '.') would return "". * * @param path * The path to parse * @param separator * The path separator character * @return Everything before the last component in the path */ public static String beforeLastPathComponent(final String path, final char separator) { return beforeLast(path, separator); }
/** * Gets everything before the last path component of a path using a given separator. If the * separator cannot be found, the path itself is returned. * <p> * For example, beforeLastPathComponent("foo.bar.baz", '.') would return "foo.bar" and * beforeLastPathComponent("foo", '.') would return "". * * @param path * The path to parse * @param separator * The path separator character * @return Everything before the last component in the path */ public static String beforeLastPathComponent(final String path, final char separator) { return beforeLast(path, separator); }
this.path = Strings.beforeLast(path, '.');
private ResourceNameIterator newResourceNameIterator(String path, String style, Locale locale, String extension) { final String realPath; final String realExtension; if ((extension == null) && (path != null) && (path.indexOf('.') != -1)) { realPath = Strings.beforeLast(path, '.'); // for extensions with separator take the first extension realExtension = Strings.afterLast(path, '.'); if (realExtension.indexOf(',') > -1) { // multiple extensions are not allowed in the path parameter return new EmptyResourceNameIterator(); } } else { realPath = path; realExtension = extension; } return new ResourceNameIterator(realPath, style, locale, realExtension); }
/** * Construct. * * @param path * The path of the resource without extension * @param style * A theme or style (see {@link org.apache.wicket.Session}) * @param locale * The Locale to apply * @param extensions * the filname's extensions (comma separated) */ public ResourceNameIterator(String path, final String style, final Locale locale, final String extensions) { this.locale = locale; if (extensions == null) { this.extensions = Strings.afterLast(path, '.'); path = Strings.beforeLast(path, '.'); } else { this.extensions = extensions; } this.styleIterator = new StyleAndVariationResourceNameIterator(path, style, null); }
this.path = Strings.beforeLast(path, '.');
path = Strings.beforeLast(path, '.');
packageName = Strings.beforeLast(packageName, '/');
packageName = Strings.beforeLast(packageName, '/');
packageName = Strings.beforeLast(packageName, '/');
realPath = Strings.beforeLast(path, '.'); String realExtension = Strings.afterLast(path, '.'); if (realExtension.indexOf(',') > -1)
realPath = Strings.beforeLast(path, '.'); String realExtension = Strings.afterLast(path, '.'); if (realExtension.indexOf(',') > -1)