1 package org.simantics.export.core.impl;
5 * @author Tuukka Lehtonen
7 public class PublisherUtil {
10 * Returns either filePath as is or filePath suffixed by
11 * <code>endsWith</code> depending on whether <code>filePath</code> ends
12 * with <code>endsWith</code> or not.
19 public static String ensureEndsWith(boolean ignoreCase, String suffix, String filePath) {
20 int suffixLen = suffix.length();
21 int filePathLen = filePath.length();
22 if (suffixLen > filePathLen)
23 return filePath + suffix;
24 if (!filePath.regionMatches(ignoreCase, filePathLen - suffixLen, suffix, 0, suffixLen))
25 return filePath + suffix;