I have a java string with user role information separated with colons. The variable
a could contain data like this:
var a = "Admin:xxxx:Data"; var a = "xxxx"; var a = "Test"; var a = "Admin"
I need to set another variable based on this formula which depends just on the Test, xxx and Data roles being present or not. Note I already have a check in place to ensure that Test and xxxx cannot both be present and that at least one of them must be present.
index = 0 if the 'Test' role appears index = 1 if the 'xxxx' role appears index = 100 if the 'Test' and 'Data' role appear index = 101 if the 'xxxx' and 'Data' roles appear
Plus another four variables:
isXxxx = true if xxxx appears isData = true if Data appears isTest = true if Test appears isAdmin = true if Admin appears
Is there a simple way that I could code this. Right now I am not sure for example how to get out the individual roles from the variable a so even if someone could advise me on just that it would probably be enough to get me going.