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

org.cybergarage.util.StringUtil Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
/******************************************************************
*
*	CyberUtil for Java
*
*	Copyright (C) Satoshi Konno 2002-2003
*
*	File: FileUtil.java
*
*	Revision:
*
*	01/12/03
*		- first revision.
*
******************************************************************/

package org.cybergarage.util;

public final class StringUtil
{
	public final static boolean hasData(String value)
	{
		if (value == null)
			return false;
		if (value.length() <= 0)
			return false;
		return true;
	}
	
	public final static int toInteger(String value)
	{
		try {
			return Integer.parseInt(value);
		}
		catch (Exception e) {
			Debug.warning(e);
		}
		return 0;
	}

	public final static long toLong(String value)
	{
		try {
			return Long.parseLong(value);
		}
		catch (Exception e) {
			Debug.warning(e);
		}
		return 0;
	}

	public final static int findOf(String str, String chars, int startIdx, int endIdx, int offset, boolean isEqual)
	{
		if (offset == 0)
			return -1;
		int charCnt = chars.length();
		int idx = startIdx;
		while (true) {
			if (0 < offset) {
				if (endIdx < idx)
					break; 
			}
			else {
				if (idx < endIdx)
					break; 
			}
			char strc = str.charAt(idx);
			int noEqualCnt = 0;
			for (int n=0; n




© 2015 - 2024 Weber Informatics LLC | Privacy Policy