fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. String vendorCode = "";
  13. String quantityValue = "";
  14. String madeInValue = "";
  15. String lineAmountValue = "";
  16. String customCodeValue = "";
  17. String itemDescriptionValue = "";
  18. String compositionX = "";
  19. String descriptionValue = "";
  20. String colorValue = "";
  21. String sizeValue = "";
  22. String currencyValue = "";
  23. String storeValue = "";
  24. String deliveryNumberValue = "";
  25. String comp = "";
  26.  
  27. String value = "1241241 Made In : sdfasd 1 PA 17.062,40 17.062,40 \n tttwe Custom Code : 5512312\n asd-asdx - asd-asda Composition : 30 % one 70 % two \n Composition : SOLE COMPOSITION: 100% three\n 123 Black 37 1";
  28.  
  29. String[] mass = value.split("\n");
  30. for(String a : mass){
  31. if(a.trim().contains("Made In")) {
  32. String[] v = a.split(" ");
  33. vendorCode = v[1];
  34. System.out.println(vendorCode);
  35. madeInValue = v[5];
  36. lineAmountValue = v[v.length-1];
  37.  
  38. } else if (a.contains("Custom code")){
  39. customCodeValue = a.substring(a.indexOf("Code : ") + 6);
  40. itemDescriptionValue = a.substring(0,a.indexOf("Custom"));
  41. } else if (a.contains("Composition :") && !a.startsWith("Composition")){
  42. descriptionValue = a.substring(0,a.indexOf("Composition"));
  43. compositionX = a.substring(a.indexOf("Composition :") + 13);
  44. } else if (a.startsWith("Composition")){
  45. comp = a.substring(a.indexOf("Composition:") + 13);
  46. if(comp.contains("SOLE")){
  47. comp = comp.substring(comp.indexOf("SOLE COMPOSITION :") + 20);
  48. }
  49. System.out.println(comp);
  50. } else {
  51. String[] v = a.split(" ");
  52. colorValue = v[0] + " " + v[1];
  53. sizeValue = v[2];
  54. quantityValue = v[3];
  55. }
  56. }
  57.  
  58. System.out.println(compositionX + "/" +comp + "hui");
  59. }
  60. }
Success #stdin #stdout 0.13s 36108KB
stdin
Standard input is empty
stdout
Made
 SOLE COMPOSITION: 100% three/hui