Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: String subdivision and data return problem

  1. #1
    Member
    Join Date
    Jun 2017
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default String subdivision and data return problem

    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?

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: String subdivision and data return problem

    Can you make a list of the problems and then chose one of the problems to work on?
    The flowing text of your post is hard to follow.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 3
    Last Post: June 26th, 2013, 02:12 AM
  2. Replies: 8
    Last Post: December 4th, 2012, 04:58 AM
  3. Need a non void method to return the first three characters of a string
    By fallout87 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 9th, 2011, 10:00 PM
  4. [SOLVED] Return randomized String to other class in project
    By Fermen in forum Collections and Generics
    Replies: 2
    Last Post: February 16th, 2011, 05:36 PM
  5. [SOLVED] Problem accessing specific data in an array and getting it to return properly
    By Universalsoldja in forum Collections and Generics
    Replies: 3
    Last Post: February 4th, 2010, 04:26 PM

Tags for this Thread