Commit 0661a987 authored by Christian P. MOMON's avatar Christian P. MOMON
Browse files

Performed step in Demo coding.

parent db922084
......@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Date;
import fr.devinsy.util.strings.StringList;
import fr.devinsy.util.strings.StringsUtils;
/**
* The Class Demo.
......@@ -58,26 +59,70 @@ public class Demo
strings.appendln("========== DEMO #2;");
strings.appendln();
strings.appendln("Easy to concatenate different types.");
strings.append("Boolean: ").append(true).append(" ").appendln(new Boolean(false));
strings.append("Char: ").append('e').append(" ").appendln(new Character('e'));
strings.append("Byte : ").append((byte) 5).append(" ").appendln(new Byte((byte) 5));
strings.append("Short: ").append((short) 55).append(" ").appendln(new Short((short) 55));
strings.append("Integer: ").append(555).append(" ").appendln(new Integer(555));
strings.append("Long: ").append(5555L).append(" ").appendln(new Long(5555));
strings.append("Float: ").append((float) 5555.5).append(" ").appendln(new Float(5555.5));
strings.append("Double: ").append(5555.55).append(" ").appendln(new Double(5555.55));
strings.append("String: ").append("abcde").append(" ").appendln(new String("edcba"));
strings.append("Object: ").appendln(new Date());
strings.append("Array of boolean:").appendln(new boolean[] { true, false, true });
strings.append("Array of char: ").appendln(new char[] { 'a', 'b', 'c' });
strings.append("Array of byte: ").appendln(new byte[] { (byte) 1, (byte) 2, (byte) 3 });
strings.append("Array of short: ").appendln(new short[] { (short) 1, (short) 2, (short) 3 });
strings.append("Array of string: ").appendln(new String[] { "a", "b", "c" });
strings.append("Boolean: ").append(true).append(" ").appendln(new Boolean(false));
strings.append("Char: ").append('e').append(" ").appendln(new Character('e'));
strings.append("Byte : ").append((byte) 5).append(" ").appendln(new Byte((byte) 5));
strings.append("Short: ").append((short) 55).append(" ").appendln(new Short((short) 55));
strings.append("Integer: ").append(555).append(" ").appendln(new Integer(555));
strings.append("Long: ").append(5555L).append(" ").appendln(new Long(5555));
strings.append("Float: ").append((float) 5555.5).append(" ").appendln(new Float(5555.5));
strings.append("Double: ").append(5555.55).append(" ").appendln(new Double(5555.55));
strings.append("String: ").append("abcde").append(" ").appendln(new String("abcde"));
strings.append("Object: ").appendln(new Date());
strings.append("Array of booleans: ").appendln(StringsUtils.toStringList(new boolean[] { true, false, true }));
strings.append("Array of chars: ").appendln(StringsUtils.toStringList(new char[] { 'a', 'b', 'c' }));
strings.append("Array of bytes: ").appendln(StringsUtils.toStringList(new byte[] { (byte) 1, (byte) 2, (byte) 3 }));
strings.append("Array of shorts: ").appendln(StringsUtils.toStringList(new short[] { (short) 1, (short) 2, (short) 3 }));
strings.append("Array of longs: ").appendln(StringsUtils.toStringList(new long[] { 1L, 2L, 3L }));
strings.append("Array of strings(1): ").appendln(new String[] { "ab", "cd", "e" });
strings.append("Array of strings(2): ").appendln("ab", "cd", "e");
strings.append("Array of objects: ").appendln(new Object[] { "ab", "cd", "e" });
ArrayList<String> buffer = new ArrayList<String>();
buffer.add("aa");
buffer.add("bb");
buffer.add("cc");
strings.append("Collections: ").appendln(buffer);
buffer.add("ab");
buffer.add("cd");
buffer.add("e");
strings.append("Collections: ").appendln(buffer);
System.out.println(strings.toString());
}
// #3
{
StringList strings = new StringList();
strings.appendln("========== DEMO #3;");
strings.appendln();
strings.appendln("Useful and easy methods.");
StringList list = new StringList("red", "blue", "green");
strings.append("Format(1): ").appendln(list.toStringWithBracket());
strings.append("Format(2): ").appendln(list.toStringWithBrackets());
strings.append("Format(3): ").appendln(list.toStringWithCommas());
strings.append("Format(4): ").appendln(list.toStringWithFrenchCommas());
strings.append("RemoveLast: ").appendln(list.removeLast().toStringWithFrenchCommas());
System.out.println(strings.toString());
}
// #4
{
StringList strings = new StringList();
strings.appendln("========== DEMO #4;");
strings.appendln();
strings.appendln("Advanced features.");
strings.append("Boolean: ").append(true).append(" ").appendln(new Boolean(false));
System.out.println(strings.toString());
}
// #5
{
StringList strings = new StringList();
strings.appendln("========== DEMO #5;");
strings.appendln();
strings.appendln("Funny features.");
strings.append("Boolean: ").append(true).append(" ").appendln(new Boolean(false));
System.out.println(strings.toString());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment