<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 7/29/16 4:51 PM, Bryan Wooten wrote:<br>
    </div>
    <blockquote cite="mid:D3C11C55.55C43%25u0519980@utah.edu"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <div><br>
      </div>
      <div><br>
      </div>
      <div>I tried all kinds of escape syntax, none worked on any
        javascript strings.</div>
    </blockquote>
    <br>
    Actually, that's a good point.  I think at that point in the script
    that value is indeed a Javascript string, not an instance of the
    Java String class.  So that might change the diagnosis and solution.
    I'm not a Javascript expert. However, I tried basically what you're
    doing in my browser's console and it seems to work as expected:<br>
    <br>
    <tt>console.log("[[Summer 2016$7981$EAS$1060$001$LEC$Expository Wrtg
      for EAS$3$1,Summer 2017$7981$EAS$1060$001$LEC$Expository Wrtg for
      EAS$3$1]]".split(",")[0].split("$"));</tt><tt><br>
    </tt><tt><br>
    </tt><tt>      Array [ "[[Summer 2016", "7981", "EAS", "1060",
      "001", "LEC", "Expository Wrtg for EAS", "3", "1" ]</tt><tt><br>
      <br>
      console.log("[[Summer 2016$7981$EAS$1060$001$LEC$Expository Wrtg
      for EAS$3$1,Summer 2017$7981$EAS$1060$001$LEC$Expository Wrtg for
      EAS$3$1]]".split(",")[0].split("$")[0]);<br>
      <br>
            [[Summer 2016<br>
    </tt><br>
    <br>
    So the '$' split delimiter doesn't seem a problem there. But that's
    plain old browser Javascript, maybe the script engine version is
    behaving differently or something.  Perhaps there the presence of
    the special character '$' results in it autoconverting that to a
    Javascript RegExp instance of something, and then that behaves
    differently.  Just speculation.  This article suggests that in
    Javascript you escape that special character like so: "\\$".<br>
    <br>
<a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/2168831/why-cant-i-split-a-string-with-the-dollar-sign">http://stackoverflow.com/questions/2168831/why-cant-i-split-a-string-with-the-dollar-sign</a><br>
    <br>
    <br>
    <blockquote cite="mid:D3C11C55.55C43%25u0519980@utah.edu"
      type="cite"><br>
      <div><br>
      </div>
      <div>However for some reason string winds up with the special char
        ‘[‘ and ‘]’… <br>
      </div>
      <div><br>
      </div>
    </blockquote>
    <br>
    Well, that's less of a mystery, I think. The "[[ .... ]]" showing up
    in the initial string you are parsing is because of your 2 initial
    calls:<br>
    <br>
    <tt>eduCourseOfferingTemp.getValues().add(uuenrl.getValues());</tt><br>
    <br>
    <tt>courses = eduCourseOfferingTemp.getValues().toString();</tt><br>
    <br>
    <br>
    The outputs of the getValues() method calls there on our
    BasicAttribute instances actually *are* Java List values.  And
    calling toString() on a standard Java List instance results in a
    string like "[value1, value2, ..., valueN]". with literal brackets.<br>
    <br>
    Btw, there is an implicit call to toString() on the argument of
    .add(uuenrl.getValues()), b/c the add() takes a single object not a
    list. <br>
    <br>
    So eduCourseOfferingTemp starts out there with a getValues() List
    with a single string value that is wrapped in a single pair of
    literal brackets. And then the second call wraps another pair of
    literal brackets around that when it converts the whole list to a
    String.<br>
    <br>
    I think you can eliminate the first pair of brackets by calling
    .addAll(uuenrl.getValues()).  You can eliminate the second pair by
    using something like a join() utility function or method to turn the
    list into a string.  But I don't offhand know if you can use a Java
    utility method there directly (we have one in java-support), or if
    you have to use native Javascript, and how the latter works in the
    scripting environment with the Java List type.  Maybe someone else
    knows.<br>
    <br>
  </body>
</html>