Renamed joinEscaped() variant that allows specifying whether to escape the
string to the more sensible join(). git-svn-id: https://samskivert.googlecode.com/svn/trunk@883 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: StringUtil.java,v 1.40 2002/10/31 01:24:10 shaper Exp $
|
// $Id: StringUtil.java,v 1.41 2002/10/31 01:44:25 shaper Exp $
|
||||||
//
|
//
|
||||||
// samskivert library - useful routines for java programs
|
// samskivert library - useful routines for java programs
|
||||||
// Copyright (C) 2001 Michael Bayne
|
// Copyright (C) 2001 Michael Bayne
|
||||||
@@ -703,19 +703,7 @@ public class StringUtil
|
|||||||
*/
|
*/
|
||||||
public static String join (String[] values)
|
public static String join (String[] values)
|
||||||
{
|
{
|
||||||
return joinEscaped(values, false);
|
return join(values, false);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Joins an array of strings into a single string, separated by
|
|
||||||
* commas, and escaping commas that occur in the individual string
|
|
||||||
* values such that a subsequent call to {@link #parseStringArray}
|
|
||||||
* would recreate the string array properly. Any elements in the
|
|
||||||
* values array that are null will be treated as an empty string.
|
|
||||||
*/
|
|
||||||
public static String joinEscaped (String[] values)
|
|
||||||
{
|
|
||||||
return joinEscaped(values, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -726,7 +714,7 @@ public class StringUtil
|
|||||||
* elements in the values array that are null will be treated as an
|
* elements in the values array that are null will be treated as an
|
||||||
* empty string.
|
* empty string.
|
||||||
*/
|
*/
|
||||||
public static String joinEscaped (String[] values, boolean escape)
|
public static String join (String[] values, boolean escape)
|
||||||
{
|
{
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
int vlength = values.length;
|
int vlength = values.length;
|
||||||
@@ -740,6 +728,18 @@ public class StringUtil
|
|||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Joins an array of strings into a single string, separated by
|
||||||
|
* commas, and escaping commas that occur in the individual string
|
||||||
|
* values such that a subsequent call to {@link #parseStringArray}
|
||||||
|
* would recreate the string array properly. Any elements in the
|
||||||
|
* values array that are null will be treated as an empty string.
|
||||||
|
*/
|
||||||
|
public static String joinEscaped (String[] values)
|
||||||
|
{
|
||||||
|
return join(values, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Splits the supplied string into components based on the specified
|
* Splits the supplied string into components based on the specified
|
||||||
* separator string.
|
* separator string.
|
||||||
|
|||||||
Reference in New Issue
Block a user