Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.paypal.base;
 
 import java.util.Map;
 
 public final class NVPUtil {
	private NVPUtil() {}

Utility method used to decode the nvp response String

Parameters:
nvpString
Returns:
Map
Throws:
java.io.UnsupportedEncodingException
	public static Map<StringStringdecode(String nvpString)
		String[] nmValPairs = nvpString.split("&");
		Map<StringStringresponse = new HashMap<StringString>();
		// parse the string and load into the object
		for (String nmVal : nmValPairs) {
			String[] field = nmVal.split("=");
			response.put(
					URLDecoder.decode(field[0], .),
					(field.length > 1) ? URLDecoder.decode(field[1].trim(),
		}
		return response;
	}

Utility method used to encode the value

Parameters:
value
Returns:
String
Throws:
java.io.UnsupportedEncodingException
	public static String encodeUrl(String value)
		return URLEncoder.encode(value.);
	}
New to GrepCode? Check out our FAQ X