---
title: "java中split的用法"
author: "jws132"
date: "2012-07-13T12:06:41Z"
tags: ["java中split的用发", "split"]
categories: ["操作系统"]
slug: "java-split"
draft: false
lastmod: "2012-07-13T12:06:41Z"
id: 1591518
url: "https://jws132.iteye.com/blog/1591518"
---

//定义的type传过来的参数 public List ProfileRoleId(String type) { List ProfileRole = new ArrayList(); ///传过来的参数列如1，2，3，4，5， String\[] profiles = type.split(","); if (profiles.length &gt; 0) { for (int i = 0; i &lt; 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; }