/* * [MoveQuotes.java] * * Summary: Move quotations from one file to another. Moved quotes are tacked on the front, and removed from the from the sounce file. * * Copyright: (c) 2015-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2015-12-30 initial version */ package com.mindprod.htmlmacros; import com.mindprod.fastcat.FastCat; import com.mindprod.hunkio.HunkIO; import java.io.File; import java.io.IOException; import static java.lang.System.*; /** * Move quotations from one file to another. Moved quotes are tacked on the front, and removed from the from the sounce file. *

* Does not check for duplicates. Works best with StripGenerated files. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2015-12-30 initial version * @since 2015-12-30 */ public class MoveQuotes { /** * what we look for surrounding text of interest */ private static final String CLOSE_TAG = ""; /** * what we look for surrounding text of interest */ private static final String OPEN_TAG = "= 0 ) { final int start2 = start1 + OPEN_TAG.length(); final int end1 = fromBig.indexOf( CLOSE_TAG, start2 ); if ( end1 < 0 ) { throw new IllegalArgumentException( ">>>missing " ); } final int end2 = end1 + CLOSE_TAG.length(); final String rawBlockQuote = fromBig.substring( start1, end2 ); final String lc = rawBlockQuote.toLowerCase(); if ( lc.contains( word ) ) { // copy the quote, drop it from from toSb.append( rawBlockQuote ); toCount++; moveCount++; } else { // keep quote in from fromSb.append( rawBlockQuote ); fromCount++; } start0 = end2; } // end while } /** * handle the footer for the to file */ private static void handleToPostlude( final boolean dry ) throws IOException { final int p = toBig.lastIndexOf( "