1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-22 08:52:18 -05:00

BaseCommand: New helpers: mergeParams(String[]), mergeParams(String[], int)

This commit is contained in:
Sebastian Kaspari 2010-03-09 22:14:07 +01:00
parent 3abf251c36
commit ea4e90fb60

View File

@ -48,4 +48,32 @@ public abstract class BaseCommand
* @return The usage description
*/
public abstract String getUsage();
/**
* Merge params to a string
*
* @params params The params to merge
*/
public static String mergeParams(String[] params)
{
return mergeParams(params, 1);
}
/**
* Merge params to a string
*
* @param params The params to merge
* @param position Start at given param
*/
public static String mergeParams(String[] params, int position)
{
StringBuffer buffer = new StringBuffer();
for (; position < params.length; position++) {
buffer.append(params[position]);
buffer.append(" ");
}
return buffer.toString().trim();
}
}