当前位置: 首页>>代码示例>>Java>>正文


Java StringUtil.count方法代码示例

本文整理汇总了Java中jodd.util.StringUtil.count方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtil.count方法的具体用法?Java StringUtil.count怎么用?Java StringUtil.count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jodd.util.StringUtil的用法示例。


在下文中一共展示了StringUtil.count方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareArrayClassnameForLoading

import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
 * Prepares classname for loading, respecting the arrays.
 * Returns <code>null</code> if class name is not an array.
 */
public static String prepareArrayClassnameForLoading(String className) {
	int bracketCount = StringUtil.count(className, '[');

	if (bracketCount == 0) {
		// not an array
		return null;
	}

	String brackets = StringUtil.repeat('[', bracketCount);

	int bracketIndex = className.indexOf('[');
	className = className.substring(0, bracketIndex);

	int primitiveNdx = getPrimitiveClassNameIndex(className);
	if (primitiveNdx >= 0) {
		className = String.valueOf(PRIMITIVE_BYTECODE_NAME[primitiveNdx]);

		return brackets + className;
	} else {
		return brackets + 'L' + className + ';';
	}
}
 
开发者ID:indic-ocr,项目名称:LibreOCR,代码行数:27,代码来源:DefaultClassLoaderStrategy.java

示例2: loadArrayClassByComponentType

import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
 * Loads array class using component type.
 */
protected Class loadArrayClassByComponentType(String className, ClassLoader classLoader) throws ClassNotFoundException {
	int ndx = className.indexOf('[');
	int multi = StringUtil.count(className, '[');

	String componentTypeName = className.substring(0, ndx);

	Class componentType = loadClass(componentTypeName, classLoader);

	if (multi == 1) {
		return Array.newInstance(componentType, 0).getClass();
	}

	int[] multiSizes;

	if (multi == 2) {
		multiSizes = new int[] {0, 0};
	} else if (multi == 3) {
		multiSizes = new int[] {0, 0, 0};
	} else {
		multiSizes = (int[]) Array.newInstance(int.class, multi);
	}

	return Array.newInstance(componentType, multiSizes).getClass();
}
 
开发者ID:indic-ocr,项目名称:LibreOCR,代码行数:28,代码来源:DefaultClassLoaderStrategy.java

示例3: prepareArrayClassnameForLoading

import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
 * Prepares classname for loading, respecting the arrays.
 * Returns <code>null</code> if class name is not an array.
 */
public static String prepareArrayClassnameForLoading(String className) {
    int bracketCount = StringUtil.count(className, '[');

    if (bracketCount == 0) {
        // not an array
        return null;
    }

    String brackets = StringUtil.repeat('[', bracketCount);

    int bracketIndex = className.indexOf('[');
    className = className.substring(0, bracketIndex);

    int primitiveNdx = getPrimitiveClassNameIndex(className);
    if (primitiveNdx >= 0) {
        className = String.valueOf(PRIMITIVE_BYTECODE_NAME[primitiveNdx]);

        return brackets + className;
    } else {
        return brackets + 'L' + className + ';';
    }
}
 
开发者ID:fivesmallq,项目名称:web-data-extractor,代码行数:27,代码来源:DefaultClassLoaderStrategy.java

示例4: loadArrayClassByComponentType

import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
 * Loads array class using component type.
 */
protected Class loadArrayClassByComponentType(String className, ClassLoader classLoader) throws ClassNotFoundException {
    int ndx = className.indexOf('[');
    int multi = StringUtil.count(className, '[');

    String componentTypeName = className.substring(0, ndx);

    Class componentType = loadClass(componentTypeName, classLoader);

    if (multi == 1) {
        return Array.newInstance(componentType, 0).getClass();
    }

    int[] multiSizes;

    if (multi == 2) {
        multiSizes = new int[]{0, 0};
    } else if (multi == 3) {
        multiSizes = new int[]{0, 0, 0};
    } else {
        multiSizes = (int[]) Array.newInstance(int.class, multi);
    }

    return Array.newInstance(componentType, multiSizes).getClass();
}
 
开发者ID:fivesmallq,项目名称:web-data-extractor,代码行数:28,代码来源:DefaultClassLoaderStrategy.java

示例5: init

import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
   @Override
public boolean init(final String actionPath, String[] separators) {
	String prefix = separators[0];
	String split = separators[1];
	String suffix = separators[2];

	macrosCount = StringUtil.count(actionPath, prefix);

	if (macrosCount == 0) {
		return false;
	}

	names = new String[macrosCount];
	patterns = new String[macrosCount];
	fixed = new String[macrosCount + 1];

	int offset = 0;
	int i = 0;

	while (true) {

		int[] ndx = StringUtil.indexOfRegion(actionPath, prefix, suffix, offset);

		if (ndx == null) {
			break;
		}

		fixed[i] = actionPath.substring(offset, ndx[0]);

		String name = actionPath.substring(ndx[1], ndx[2]);

		// name:pattern
		String pattern = null;

		int colonNdx = name.indexOf(split);
		if (colonNdx != -1) {
			pattern = name.substring(colonNdx + 1).trim();

			name = name.substring(0, colonNdx).trim();
		}

		this.patterns[i] = pattern;
		this.names[i] = name;

		// iterate
		offset = ndx[3];
		i++;
	}

	if (offset < actionPath.length()) {
		fixed[i] = actionPath.substring(offset);
	} else {
		fixed[i] = StringPool.EMPTY;
	}

	return true;
}
 
开发者ID:febit,项目名称:febit-common,代码行数:61,代码来源:BasePathMacros.java


注:本文中的jodd.util.StringUtil.count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。