public void getTraduttoreIt_ENUM_NLS() throws Exception { List<EnumNls> db2 = getListEnumNls(); List<DizioPt> sqlServer = getListDizioPt(); //Espressioni regolari Pattern prefissoDescrizionePattern = Pattern.compile("(\\d+\\s*-\\s*)?(.*)"); BufferedWriter scrivi = new BufferedWriter( new FileWriter("C:/Users/francesco/Desktop/Table_THERA.ENUM_NLS_Sez4.txt")); System.out.println("-------------------WRITE FILE N°4--------TRANSLATION------------------------"); for (int i = 0; i < db2.size(); i++) { //Catturo il valore nell'input Matcher enumDescPulito = prefissoDescrizionePattern.matcher(db2.get(i).getEnumDesc()); for (int j = 0; j < sqlServer.size(); j++) { //Faccio la ricerca if(enumDescPulito.find() == true) { if (enumDescPulito.equals(sqlServer.get(j).getKeyword())) { System.out.println( "INSERT INTO THERA.ENUM_NLS VALUES" + "(" + "'" + db2.get(i).getAttributeRef().trim() + "'" + "," + "'" + db2.get(i).getEnumValue().trim() + "'" + "," + "'" + "en" + "'" + "," + "'" + sqlServer.get(j).getTraduzione().trim() + "'" + ")" + ";"); scrivi.write("INSERT INTO THERA.ENUM_NLS VALUES" + "(" + "'" + db2.get(i).getAttributeRef().trim() + "'" + "," + "'" + db2.get(i).getEnumValue().trim() + "'" + "," + "'" + "en" + "'" + "," + "'" + sqlServer.get(j).getTraduzione().trim() + "'" + ")" + ";"); scrivi.newLine(); scrivi.flush(); } } } } scrivi.close(); }
in addition to returning the db2.get (i) .getEnumDesc () strings which are normal strings. there are some strings like: 1 - Selected house in db2.get (i) .getEnumDesc () I have to cut -> 1 - I have translated the selected part of the house and then reassembled it. 1 - select house in practice, in output, not only normal strings have to be returned, but also strings with numbers, ie 1 - select house in printed output: es. house hello 1 - select 2 - bye etc...
the problem that there are no errors: That I can't implement this problem: In the double for loop I did, in addition to returning normal strings, it must also return strings starting with numbers. es. Output to print: home, dog, 1 - mouse, 2 - red I only print dog and home, instead it doesn't print 1 - mouse and 2 - red because when I make equality between a record of the first table and the record of the second table I find only home and dog. YOU MUST MAKE THE REGULAR EXPRESSION THAT I DO NOT KNOW APPLY. –
if I cut the string "1 -" and make the equality between the first mouse record of one table and the other record of the other table, I find myself mouse and then I have to concatenate the string translated from Italian to English 1 - mouse. How you do it?
it only needs to accept the values from 0 to 9, the hyphen and finally all the strings through regular expressions When I have to print, not only must it print eg. dog home 1 - hello 2 - hello c .... can you help me implement the code?
//Espressioni regolari Pattern prefissoDescrizionePattern = Pattern.compile("(\\d+\\s*-\\s*)?(.*)"); BufferedWriter scrivi = new BufferedWriter( new FileWriter("C:/Users/francesco/Desktop/Table_THERA.ENUM_NLS_Sez4.txt")); System.out.println("-------------------WRITE FILE N°4--------TRANSLATION------------------------"); for (int i = 0; i < db2.size(); i++) { //Catturo il valore nell'input Matcher enumDescPulito = prefissoDescrizionePattern.matcher(db2.get(i).getEnumDesc()); for (int j = 0; j < sqlServer.size(); j++) { //Faccio la ricerca if(enumDescPulito.find() == true) { if (enumDescPulito.equals(sqlServer.get(j).getKeyword())) {
can you help me to complete the code, which does not give any error?