Как использовать пользовательский CSS с Bootstrap 4 и Rails 5

Изменено Pattern.split () , чтобы включить сопоставленный шаблон в список

Добавлено

// add match to the list
        matchList.add(input.subSequence(start, end).toString());

Полный источник

public static String[] inclusiveSplit(String input, String re, int limit) {
    int index = 0;
    boolean matchLimited = limit > 0;
    ArrayList matchList = new ArrayList();

    Pattern pattern = Pattern.compile(re);
    Matcher m = pattern.matcher(input);

    // Add segments before each match found
    while (m.find()) {
        int end = m.end();
        if (!matchLimited || matchList.size() < limit - 1) {
            int start = m.start();
            String match = input.subSequence(index, start).toString();
            matchList.add(match);
            // add match to the list
            matchList.add(input.subSequence(start, end).toString());
            index = end;
        } else if (matchList.size() == limit - 1) { // last one
            String match = input.subSequence(index, input.length())
                    .toString();
            matchList.add(match);
            index = end;
        }
    }

    // If no match was found, return this
    if (index == 0)
        return new String[] { input.toString() };

    // Add remaining segment
    if (!matchLimited || matchList.size() < limit)
        matchList.add(input.subSequence(index, input.length()).toString());

    // Construct result
    int resultSize = matchList.size();
    if (limit == 0)
        while (resultSize > 0 && matchList.get(resultSize - 1).equals(""))
            resultSize--;
    String[] result = new String[resultSize];
    return matchList.subList(0, resultSize).toArray(result);
}

0
задан Simonp27 18 January 2019 в 13:09
поделиться

1 ответ

Даже если вы поставите layout: false, Rails продолжит загружать application.scss. Вы можете создать часть sass (если вы используете sass) и импортировать ее в application.scss

0
ответ дан escanxr 18 January 2019 в 13:09
поделиться
Другие вопросы по тегам:

Похожие вопросы: