My requirement is that there are thousands of similar data in the SQL file, and I want to convert them into formats such as
First step: Replace the character segment, use Word layout to copy the data to Word, replace it with special characters
Click Replace All to replace, for example, when it is a string of long strings
Step two: Write the Java replacement program in code NUM is a split segment, and the 16th character is a newline
public class Demo {public static void main (string[] args) {String s = "' 133 ', ' 153 ', ' 180 ', ' 181 ', ' 189 ', ' 177 ', ' 130 ', ' 131 ', ' 1 32 ', ' 155 ', ' 156 ', ' 145 ', ' 185 ', ' 186 ', ' 176 ', ' 134 ', ' 135 ', ' 136 ', ' 137 ', ' 138 ', ' 139 ', ' 150 ', ' 151 ', ' 152 ', ' 182 ', ' 183 ', ' 184 ', ' 157 ', ' 187 ', ' 188 ', ' 147 ', ' 178 ', ' 170 '; String str[] = S.split (","); StringBuilder sb = new StringBuilder (); StringBuilder rs = new StringBuilder (); int num = 15; 15 is the segmented segment int yu = str.length% Num;int a = 0;for (int i = 0; i < str.length; i++) {a++;sb.append (Str[i] + ","); if (A = = num) {a = 0;rs.append (sb + "\ n"); sb = new StringBuilder ();}} SB = new StringBuilder (); for (int i = yu; i > 0; i--) {sb.append (Str[str.length-i] + ",");} Rs.append (SB); System.out.println (rs.substring (0, Rs.length ()-1)); System.out.println ("\ n" + str.length + ":" + (Rs.tostring (). Split (","). length));}}
After running as
Step three: Replace the output characters with the SQL characters
such as the following effect
Java Bulk replaces a paragraph in a file with a space, wrapping it according to a specified delimiter (SQL example)