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

de.bytefish.pgbulkinsert.util.StringUtils Maven / Gradle / Ivy

There is a newer version: 7.0.1
Show newest version
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

package de.bytefish.pgbulkinsert.util;

import java.nio.charset.Charset;

public class StringUtils {
	
	private static Charset utf8Charset = Charset.forName("UTF-8");

    private StringUtils() {}

    public static boolean isNullOrWhiteSpace(String input) {
        return  input == null || input.trim().length() == 0;
    }

    public static byte[] getUtf8Bytes(String value) {
        return value.getBytes(utf8Charset);
    }

	public static String removeNullCharacter(String data) {
		if (data == null) {
			return data;
		}

		return data.replaceAll("\u0000", "");
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy