<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>Thanks Brent,</div>
<div><br>
</div>
<div>I tried all kinds of escape syntax, none worked on any javascript strings.</div>
<div><br>
</div>
<div>But I found a solution.</div>
<div><br>
</div>
<div>I found that var string = basicAttribute.getValues().toString().replace($,-); will successfully get rid of the special char and then I could just split() on -.</div>
<div><br>
</div>
<div>However for some reason string winds up with the special char [ and ]
And those have the same issue as $
</div>
<div><br>
</div>
<div>Anyway with much clugdy code I got the results I needed.</div>
<div><br>
</div>
<div>Lesson learned: dont use special chars for delimiters.</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Brent Putman <<a href="mailto:putmanb@georgetown.edu">putmanb@georgetown.edu</a>><br>
<span style="font-weight:bold">Reply-To: </span>"<a href="mailto:users@shibboleth.net">users@shibboleth.net</a>" <<a href="mailto:users@shibboleth.net">users@shibboleth.net</a>><br>
<span style="font-weight:bold">Date: </span>Friday, July 29, 2016 at 1:00 PM<br>
<span style="font-weight:bold">To: </span>"<a href="mailto:users@shibboleth.net">users@shibboleth.net</a>" <<a href="mailto:users@shibboleth.net">users@shibboleth.net</a>><br>
<span style="font-weight:bold">Subject: </span>[Ext] Re: Scripted Attribute / weird issue<br>
</div>
<div><br>
</div>
<div>
<div bgcolor="#FFFFFF" text="#000000">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 7/29/16 12:35 PM, Bryan Wooten wrote:<br>
</div>
<blockquote cite="mid:E3F0D94BB1E0F840B2E26B77ED38F20D6A729655@X-MB13.xds.umail.utah.edu" type="cite">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1"><o:p></o:p>
<p class="MsoNormal"> element = ca[0].split("$");<o:p></o:p></p>
<o:p></o:p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">So the split on , on the courses string works, but the split on $ on ca[0] doesnt do anything.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If I change $ to 2 it will split on the 2.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Also note that a replace on $ doesnt work either.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Any ideas? My google foo is totally failing
.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p><br>
</p>
</div>
</blockquote>
<br>
Well, the input to the Java String split() function is a regular expression, and the '$' is a special character. [1]<br>
<br>
So if you want to split on a literal '$', you have to escape it. Try split("\$"). (Or if that doesn't work try split("\\$"). In some cases with string literals in Java you have to have 2 escape characters and I can never remember when/why. Don't know which
case this is.)<br>
<br>
<br>
<br>
[1] <a class="moz-txt-link-freetext" href="https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#sum">
https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#sum</a><br>
</div>
</div>
</span>
</body>
</html>