Java Array to String toString(String[] args, char color1, char color2)

Here you can find the source of toString(String[] args, char color1, char color2)

Description

to String

License

Open Source License

Declaration

public static String toString(String[] args, char color1, char color2) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    public static String toString(String[] args, char color1, char color2) {
        StringBuilder stringBuilder = new StringBuilder();

        if (args.length > 1) {
            for (int iii = 0; iii < args.length - 1; iii++) {
                stringBuilder.append("\247");
                stringBuilder.append(color1);
                stringBuilder.append(args[iii]);
                stringBuilder.append("\247");
                stringBuilder.append(color2);
                stringBuilder.append(", ");
            }/*from  www . java 2 s .c om*/
        }

        stringBuilder.append("\247");
        stringBuilder.append(color1);
        stringBuilder.append(args[args.length - 1]);

        return stringBuilder.toString();
    }

    public static String toString(List<String> args, char color1, char color2) {
        return toString(args.toArray(new String[args.size()]), color1, color2);
    }
}

Related

  1. toString(Object[] array)
  2. toString(Object[] array)
  3. toString(Object[] array)
  4. toString(Object[] objects)
  5. toString(String arrayName, T[] targets)
  6. toString(String[] arguments)
  7. toString(String[] array, String delimiter)
  8. toString(String[] line)
  9. toString(String[] paramNames, Object[] params)