| New file |
| | |
| | | package com.dji.sample.patches.utils; |
| | | |
| | | import java.util.List; |
| | | |
| | | import static org.locationtech.jts.io.WKTConstants.POLYGON; |
| | | |
| | | public class FormatConversionUtil { |
| | | public static String[] formatConversion(List<String> s) { |
| | | String str = s.toString().trim(); |
| | | String ses = str.substring(1, str.length() - 2); |
| | | String see = ses.replaceAll("\\[\\[\\[\\[", "((") |
| | | .replaceAll("].\\[", " ") |
| | | .replaceAll("]]]", "))"); |
| | | String[] arr1 = see.split("],"); |
| | | return arr1; |
| | | } |
| | | |
| | | public static String modifySpacesAndCommas(String str) { |
| | | StringBuilder modified = new StringBuilder(); |
| | | for (char c : str.toCharArray()) { |
| | | if (c == ' ') { |
| | | modified.append(','); |
| | | } else if (c == ',') { |
| | | modified.append(' '); |
| | | } else { |
| | | modified.append(c); |
| | | } |
| | | } |
| | | return modified.toString(); |
| | | } |
| | | } |