February 6, 200817 yr Hello, I'm using your ScriptMaster plugin (1.6.3), and I have a Java/Groovy problem that I cannot resolve, despite researching it online. Suppose I have the following code: fruits = apple~orange~banana~~~; fruitsArray = fruits.split("~"); Apparently, Java discards the trailing empty strings, which means referencing fruitsArray[4] produces an error (which often causes FileMaker to hang), so how I can preserve the trailing empty strings? Regards, Sean Mills
February 8, 200817 yr Sean, use the version of split that takes two args, and pass in a -1 as the second param. See the documentation here: String.split(String regex,int limit) This will return an arry of 6 objects in your example, instead of 3.
February 10, 200817 yr Author Jesse, thanks so much. That worked! You know, I actually did look at the other version of String.Split, but I simply entered a large number. Didn't know about the -1 parameter. Sean
Create an account or sign in to comment