code: private static String stripExtraLineEnd(String text, boolean formalRTF)
     {
        if (formalRTF && text.endsWith("\n"))
        {
           text = text.substring(0, text.length() - 1);
        }
        return text;
     }
docs: Remove the trailing line end from an RTF block.
  
  @param text source text
  @param formalRTF true if this is a real RTF block
  @return text with line end stripped