java如何构造一个方法,把字符串数组转化为字符串并且以逗号分隔
join(selenium.getSelectOptions("verticalSearchForm_criteriaFilter_industry"),',')priv...
join(selenium.getSelectOptions("verticalSearchForm_criteriaFilter_industry"),',')
private Object join(String[] selectOptions, char c) {
// TODO Auto-generated method stub
return null;
} 展开
private Object join(String[] selectOptions, char c) {
// TODO Auto-generated method stub
return null;
} 展开
1个回答
展开全部
public class YuGiOh
{
private Object join ( String[] selectOptions, char c )
{
String result = "";
for ( String string : selectOptions )
{
result += string + c;
}
return result.replaceAll (c + "$", "");
}
public static void main ( String[] args )
{
YuGiOh yuGiOh = new YuGiOh ();
System.out.println (yuGiOh.join (new String[] { "verticalSearchForm,criteriaFilter,industry" }, ','));
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询