Example usage for com.liferay.portal.kernel.util StringUtil indexOfAny

List of usage examples for com.liferay.portal.kernel.util StringUtil indexOfAny

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util StringUtil indexOfAny.

Prototype

public static int indexOfAny(String s, String[] texts) 

Source Link

Document

Returns the index within the string of the first occurrence of any string from the array.

Usage

From source file:com.liferay.exportimport.internal.content.processor.test.DefaultExportImportContentProcessorTest.java

License:Open Source License

protected String replaceMultiLocaleLayoutFriendlyURLs(String content) {
    if (StringUtil.indexOfAny(content, _MULTI_LOCALE_LAYOUT_VARIABLES) <= -1) {

        return content;
    }/*from www .j a  v a  2s.c o m*/

    List<String> urls = ListUtil.toList(StringUtil.splitLines(content));

    List<String> outURLs = new ArrayList<>();

    for (String url : urls) {
        outURLs.add(url);

        if (StringUtil.indexOfAny(url, _MULTI_LOCALE_LAYOUT_VARIABLES) > -1) {

            outURLs.add(StringUtil.replace(url, _MULTI_LOCALE_LAYOUT_VARIABLES,
                    _NON_DEFAULT_MULTI_LOCALE_LAYOUT_VARIABLES));
        }
    }

    return StringUtil.merge(outURLs, StringPool.NEW_LINE);
}