Friday, May 13, 2016

Transform Map to CSV (Comma Separated Values) Acceptable Acceptable String



Code Snippet :

       /**
        * Transform mapto string instances.
        *
        * @param propertymapperValues the propertymapper values
        * @return the string
        */
       private static String transformMaptoStringInstances(Map<String,String> propertymapperValues){
         StringBuilder _buildCSVContends = new StringBuilder();
         for(Entry<String,String> entryInstances : propertymapperValues.entrySet()){
           _buildCSVContends.append("\""+entryInstances.getKey()+"\"");
           _buildCSVContends.append(",");
           _buildCSVContends.append("\""+entryInstances.getValue()+"\"");
           _buildCSVContends.append("\n");
         }
         return _buildCSVContends.toString();
       }

No comments:

Post a Comment