Here you can find the source of splitOnNoWiki(String s)
Parameter | Description |
---|---|
s | _more_ |
private static List<String> splitOnNoWiki(String s)
//package com.java2s; /*//w w w . j av a 2s. com * Copyright (c) 2008-2018 Geode Systems LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.util.ArrayList; import java.util.List; public class Main { /** * _more_ * * @param s _more_ * * @return _more_ */ private static List<String> splitOnNoWiki(String s) { List<String> content = new ArrayList<String>(); int idx = s.indexOf("<nowiki>"); int tagLength1 = "<nowiki>".length(); int tagLength2 = "</nowiki>".length(); //.... <nowiki>.....</nowiki> .... while ((idx >= 0) && (s.length() > 0)) { content.add(s.substring(0, idx)); s = s.substring(idx + tagLength1); int idx2 = s.indexOf("</nowiki>"); if (idx2 < 0) { content.add(s); s = ""; break; } String nowiki = s.substring(0, idx2); content.add(nowiki); s = s.substring(idx2 + tagLength2); idx = s.indexOf("<nowiki>"); } content.add(s); return content; } }