Here you can find the source of quoteForCsv(final String field)
Parameter | Description |
---|---|
field | the field |
private static String quoteForCsv(final String field)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w ww . ja v a 2 s .c om*/ * Inserts quotation marks around a field if it contains commas * * @param field * the field * * @return the field that is ready for inserting into a CSV line */ private static String quoteForCsv(final String field) { if (field != null && field.contains(",")) { return "\"" + field + "\""; } return field; } }