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

com.nepxion.discovery.common.util.StringUtil Maven / Gradle / Ivy

Go to download

Nepxion Discovery is a solution for Spring Cloud with blue green, gray, weight, limitation, circuit breaker, degrade, isolation, monitor, tracing, dye, failover, async agent

There is a newer version: 6.22.0
Show newest version
package com.nepxion.discovery.common.util;

/**
 * 

Title: Nepxion Discovery

*

Description: Nepxion Discovery

*

Copyright: Copyright (c) 2017-2050

*

Company: Nepxion

* @author Haojun Ren * @version 1.0 */ import java.util.Arrays; import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; public class StringUtil { public static List splitToList(String value, String separate) { if (StringUtils.isEmpty(value)) { return null; } String[] valueArray = StringUtils.split(value, separate); return Arrays.asList(valueArray); } public static String simulateText(String value, int size, String padValue) { return StringUtils.rightPad(value, size, padValue); } public static String simulateText(int size) { return simulateText("10", size, "10"); } public static String toDisplaySize(String value) { return FileUtils.byteCountToDisplaySize(value.length()); } public static int count(String text, String keyText) { if (StringUtils.isEmpty(text) || StringUtils.isEmpty(keyText)) { return -1; } int count = 0; while (text.indexOf(keyText) != -1) { text = text.substring(text.indexOf(keyText) + 1, text.length()); count++; } return count; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy