Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/tecnick/htmlutils/htmlstrings/sample/HTMLStringsSample.java


1   package com.tecnick.htmlutils.htmlstrings.sample;
2   
3   import com.tecnick.htmlutils.htmlstrings.HTMLStrings;
4   
5   /**
6    * Implementation example of HTMLStrings class.<br/><br/>
7    * Copyright (c) 2004-2005 Tecnick.com S.r.l (www.tecnick.com) Via Ugo Foscolo
8    * n.19 - 09045 Quartu Sant'Elena (CA) - ITALY - www.tecnick.com -
9    * info@tecnick.com<br/>
10   * License: http://www.gnu.org/copyleft/lesser.html LGPL
11   * @author Nicola Asuni [www.tecnick.com].
12   * @version 1.0.003
13   */
14  public class HTMLStringsSample {
15    
16    protected static String rawstr = new String("\nline one\nline two\nline three\nàèìòù");
17    
18    /**
19     * Prints 2 strings on System.out
20     * @param args String[]
21     */
22    public static void main(String[] args) {
23      System.out.println("\noriginal string:" + rawstr);
24      System.out.println("\ncompactString:" + HTMLStrings.compactString(rawstr));
25      System.out.println("\nautoBR:" + HTMLStrings.autoBR(rawstr));
26      
27      String tmpstr = HTMLStrings.getEncodedString(rawstr, "UTF-8", "ISO-8859-1");
28      System.out.println("\nencoding ISO-8859-1:" + tmpstr);
29          
30      tmpstr = HTMLStrings.getEncodedString(tmpstr, "ISO-8859-1", "UTF-8");
31      System.out.println("\nencoding UTF-8:" + tmpstr);
32    }    
33  }