Coverage Report - rs.mgifos.mosquito.model.MetaUtils
 
Classes in this File Line Coverage Branch Coverage Complexity
MetaUtils
0%
0/14
0%
0/4
2
 
 1  
 /* 
 2  
  * This file is part of Mosquito meta-loader.
 3  
  *
 4  
  * Mosquito meta-loader is free software; you can redistribute it and/or modify
 5  
  * it under the terms of the GNU Lesser General Public License as published by
 6  
  * the Free Software Foundation; either version 3 of the License, or
 7  
  * (at your option) any later version.
 8  
  *
 9  
  * Mosquito meta-loader is distributed in the hope that it will be useful,
 10  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12  
  * GNU Lesser General Public License for more details.
 13  
  *
 14  
  * You should have received a copy of the GNU Lesser General Public License
 15  
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 16  
  */
 17  
 
 18  
 package rs.mgifos.mosquito.model;
 19  
 
 20  
 
 21  
 /**
 22  
  *
 23  
  * @author <a href="mailto:nikola.petkov@gmail.com">Nikola Petkov &lt;nikola.petkov@gmail.com&gt;</a>
 24  
  */
 25  
 public class MetaUtils {
 26  0
     private MetaUtils() {
 27  0
     }
 28  
 
 29  
     /**
 30  
      * 
 31  
      * @param aStringToFormat
 32  
      * @param aBreakOn
 33  
      * @return formatted html string with breaks
 34  
      */
 35  
     public static String insertHTMLBreaks(String aStringToFormat, int aBreakOn) {
 36  0
         String retVal = new String();
 37  0
         int start = 0, end = 0;
 38  0
         final int len = aStringToFormat.length();
 39  0
         final int lastIndex = (len == 0) ? 0 : len - 1;
 40  
         while (true) {
 41  0
             start = end;
 42  0
             end += aBreakOn;
 43  0
             if (end >= lastIndex) {
 44  0
                 end = lastIndex;
 45  0
                 retVal += aStringToFormat.subSequence(start, end);
 46  0
                 break;
 47  
             }
 48  0
             retVal += aStringToFormat.subSequence(start, end) + "<BR>";
 49  
         }
 50  0
         return retVal;
 51  
     }
 52  
 
 53  
 }