String
value components.
*
* @author fredt@users
* @author boucherb@users
* @version 1.7.2
* @since 1.7.0
*/
public class StringUtil
{
//public static string getList(Object[] s, string separator, string quote)
//{
// int len = s.Length;
// StringBuilder b = new StringBuilder(len * 16);
// for (int i = 0; i < len; i++)
// {
// b.Append(quote);
// b.Append(s[i]);
// b.Append(quote);
// if (i + 1 < len)
// {
// b.Append(separator);
// }
// }
// return b.ToString();
//}
/**
* Builds a CSV list from the specified int[], separator
* String
and quote
String
. * *
separator
argument.
* quote
argument.
* String
to use as the separator
* @param quote the String
with which to quote the list elements
*/
public static string getList(int[] s, string separator, string quote)
{
int len = s.Length;
StringBuilder b = new StringBuilder(len * 8);
for (int i = 0; i < len; i++)
{
b.Append(quote);
b.Append(s[i]);
b.Append(quote);
if (i + 1 < len)
{
b.Append(separator);
}
}
return b.ToString();
}
}
}