Here you can find the source of getNeoString(String columnName, String delimiter, Collection
private static String getNeoString(String columnName, String delimiter, Collection<String> input, String join)
//package com.java2s; /*/*from ww w . jav a 2 s . c o m*/ * * Copyright (c) 2012-2016 "FlockData LLC" * * This file is part of FlockData. * * FlockData is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * FlockData is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with FlockData. If not, see <http://www.gnu.org/licenses/>. */ import java.util.Collection; public class Main { private static String getNeoString(String columnName, String delimiter, Collection<String> input, String join) { String result = "";//(delimiter.equals(":")? ":": ""); for (String field : input) { if (field != null) { // ToDo: Fix this hack if (field.equals("User")) field = "_FortressUser"; if (requiresQuoting(field)) field = "`" + field + "`"; if (result.equals(delimiter) || result.equals("")) result = result + (columnName != null ? columnName + delimiter : "") + field + ""; else result = result + join + (columnName != null ? columnName : "") + delimiter + field; } } if (result.equals(delimiter)) result = ""; return result; } /** * * @param string to analyze * @return true if the string requires quoting in the world of Cypher */ public static boolean requiresQuoting(String string) { return string.contains(" ") || string.contains("-") || string.contains(".") || string.matches("^[\\d\\-\\.]+$"); } }