This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I need only need the UserID= part . How do I do it. If it was in a map, I could do something like header.get("UserID"). But it wouldn't allow me to do that, how do I get round it. I need to pass the USerID somewhere in my code.
I don't think Kel's suggestion is appropriate here.
substring and indexOf() would be one way to do this; the newer String.split() method would be another. Splitting several times, using ',' and then '=' as separator, would let you break this into key, value pairs, and then into individual keys and values.
CSP-User-Info: AccountID=250387,Login%u0020Name=sampath,UserId=79 ========= 1. use String.split(",") split the String to a String array 2. then conversion the String array to a HashMap(key, value),(you need write a method by yourself.) 3. use HashMap's get(Object key) method get what you want value
4. then you can reuse this method in other class
Joined: Oct 06, 2007
Hello Guys, I was able to get the string and then I had to break it down using String tokenizer. The value I want at this time is the one stored in String f4 which is the value of the user ID.
I need this f4 in another part of my code , how do I get it.