Mercurial > dive4elements > river
diff gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StringArrayParseHelper.java @ 9270:7337034eb5d5
multiple whitespace input fix
author | gernotbelger |
---|---|
date | Thu, 19 Jul 2018 13:36:38 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StringArrayParseHelper.java Thu Jul 19 13:36:38 2018 +0200 @@ -0,0 +1,32 @@ +/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ +package org.dive4elements.river.client.client.ui; + +/** + * @author Domenico Nardi Tironi + * + */ +public class StringArrayParseHelper { + + public static final String[] getArrayFromRawString(final String raw) { + if (raw != null) { + return raw.trim().replaceAll("\\s+", " ").split(" "); + } + return new String[] {}; + } + + public static final String trimRawString(final String raw) { + if (raw != null) { + return raw.trim().replaceAll("\\s+", " "); + } + return ""; + } + +}