java中split的用法

//定义的type传过来的参数
public List<Profile> ProfileRoleId(String type) {
   List<Profile> ProfileRole = new ArrayList<Profile>();
    ///传过来的参数列如1,2,3,4,5,
   String[] profiles = type.split(",");
if (profiles.length > 0) {
    for (int i = 0; i < profiles.length; i++) {
System.out.println("profileId: " + profiles[i]);
Users users = new Users();
                  //循环把type的参数查询出来
users = this.usersMapper.Users_Type(profiles[i]);
    if (null != users) {
ProfileRole.add(profile);
}
}
}
return ProfileRole;
}

猜你喜欢

转载自jws132.iteye.com/blog/1591518