Scripted Attribute / weird issue

Brent Putman putmanb at georgetown.edu
Fri Jul 29 15:00:35 EDT 2016



On 7/29/16 12:35 PM, Bryan Wooten wrote:
>
>           element = ca[0].split("$");
>
>  
>
> So the split on ‘,’ on the courses string works, but the split on ‘$’
> on ca[0] doesn’t do anything.
>
>  
>
> If I change ‘$’ to ‘2’ it will split on the ‘2’.
>
>  
>
> Also note that a replace on ‘$’ doesn’t work either.
>
>  
>
> Any ideas? My google foo is totally failing….
>
>  
>

Well, the input to the Java String split() function is a regular
expression, and the '$' is a special character. [1]

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.)



[1]
https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#sum
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20160729/98de59c0/attachment.html>


More information about the users mailing list