Java 确定字符串数组或字符串数组是否为Grails

Java 确定字符串数组或字符串数组是否为Grails,java,arrays,string,grails,Java,Arrays,String,Grails,我试图弄清楚我拥有的数组是否有多个与之关联的字符串,或者它是否只是一个字符数组(字符串)。现在,如果我输入一个1234的单数ID,我将得到一个1,2,3,4的数组,但是如果我说有两个ID的12和34,数组将返回12,34。当字符串应该始终是字符串数组时,如何检查字符串 <div class="area"> <h2>Select all people who will be Traveling</h2> <div> <g:if test="${

我试图弄清楚我拥有的数组是否有多个与之关联的字符串,或者它是否只是一个字符数组(字符串)。现在,如果我输入一个1234的单数ID,我将得到一个1,2,3,4的数组,但是如果我说有两个ID的12和34,数组将返回12,34。当字符串应该始终是字符串数组时,如何检查字符串

<div class="area">
<h2>Select all people who will be Traveling</h2>
<div>
<g:if test="${disabled=='false'}">
 <g:select name="selector" class="claim" value="None" from="${fullList}" optionKey="studentID" optionValue="${{it.firstName + ' ' + it.lastName}}" noSelection="${['null':' ']}" disabled="${disabled}"/>
   <g:if test="${tripInstance?.student!= null }">
   <g:each var="i" in="${(0..<tripInstance?.student?.length) }">
    <div>
     <input class='field' name='Name' readonly type='text' value='${fullList.firstName[(tripInstance?.student[i]).toInteger()]} ${fullList.lastName[(tripInstance?.student[i]).toInteger()]}'/>
     <input class='field' name='student' readonly type='hidden' value='${tripInstance?.student[i]}'/>
       <label class='removeEdit fakeLink'> Remove</label>
    </div>
   </g:each>
   </g:if>
</g:if>

<g:if test="${disabled=='true'}">
<g:if test="${tripInstance?.student!= null }">
 <g:each var="i" in="${(0..<tripInstance?.student?.size()) }">
  <div>
   <input class='field' name='student' readonly disabled="${disabled}" type='text' value='${tripInstance?.student[i]}'/>
  </div>
 </g:each>
 </g:if>
</g:if>
</div>
</div>

选择所有将要旅行的人
去除

我已尝试基于类进行检查。我不能基于大小进行检查,因为字符串和字符串数组都有大小。它是一个字符串数组而不是Int数组,因为代码的其他部分希望它采用这种格式。希望我没有忽略一些简单的东西。

Grails在
params
对象上提供了一个方便的方法,可以始终返回一个列表,而不可能遍历单个字符串。它被方便地称为
list()


它可以在文档中找到。

它不是
1234
1234
1,2,34
12,3,4
?基本上,如何确定有效状态?它可以是ID为1和234的学生,但数组将注册这两个独立的元素,但是如果只有一个学生ID为91或123甚至4(任意位数,但只有一个条目),数组将成为字符数组,并将一个条目拆分为多个元素,但如何消除歧义呢?你说“阵列”。。。什么数组?tripInstance?.student是从完整列表中显示并由用户选择的ID字符串[]。但是,如果用户tripInstance?只选择了一个ID,则student将成为一个字符数组,其中任何两位数或更高的数字都将成为多个元素,而不是单个元素。除此之外,我不知道如何描述这个问题对不起。
def ids = params.list('ids')