All Downloads are FREE. Search and download functionalities are using the official Maven repository.

lucee.runtime.util.Strings Maven / Gradle / Ivy

There is a newer version: 6.2.0.164-RC
Show newest version
/**
 * Copyright (c) 2015, Lucee Association Switzerland. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either 
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public 
 * License along with this library.  If not, see .
 * 
 */
package lucee.runtime.util;

public interface Strings {

	/**
	 * performs a replace operation on a string
	 * 
	 * @param input - the string input to work on
	 * @param find - the substring to find
	 * @param repl - the substring to replace the matches with
	 * @param firstOnly - if true then only the first occurrence of {@code find} will be replaced
	 * @param ignoreCase - if true then matches will not be case sensitive
	 * @return Returns a string the the substring replaced.
	 */
	public String replace(String input, String find, String repl, boolean firstOnly, boolean ignoreCase);

	public String toVariableName(String str, boolean addIdentityNumber, boolean allowDot);

	/**
	 * return first element of the list
	 * 
	 * @param list List
	 * @param delimiter delimiter of the list
	 * @param ignoreEmpty ignore empty
	 * @return returns the first element of the list
	 */
	public String first(String list, String delimiter, boolean ignoreEmpty);

	/**
	 * return last element of the list
	 * 
	 * @param list List
	 * @param delimiter delimiter of the list
	 * @param ignoreEmpty ignore empty
	 * @return returns the last Element of a list
	 */
	public String last(String list, String delimiter, boolean ignoreEmpty);

	/**
	 * removes quotes(",') that wraps the string
	 * 
	 * @param string string
	 * @param trim trim
	 * @return Returns a string without wrapping quotes.
	 */
	public String removeQuotes(String string, boolean trim);

	public long create64BitHash(CharSequence cs);

	public boolean isEmpty(String str);

	public boolean isEmpty(String str, boolean trim);

	public String emptyIfNull(String str);

	public boolean startsWithIgnoreCase(String haystack, String needle);

	public boolean endsWithIgnoreCase(String haystack, String needle);

	public String ucFirst(String str);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy