I have this program part, which puts specific numbers in all sections. What I would like to have is to make the iterator keep counting the words, even if the word are same. This recent code sets the same number when same word comes again. For example it should approximately look like this:
Before -------------------->>>> After
AAAA -------------------->>>> 001 AAAA
BBB --------------------->>>> 002 BBB
CCCC ----------------->>>>>> 003 CCCC
BBB ---------------------->>>>>> 004 BBB
Can I somehow solve it with if? for example in the example above:
int i=0; if (val[1].equals("BBB"){ i++; if(i==2){sections.put("004","BBB"); //only the second B must be changed at all times, that's why I thought when i=2 then section.put(....) stuff can be used.
`
// List of all Sections, [0]=Code, [1]=Expression
I hope I explained clearly. Any suggestions?
static final ArrayList<String[]> sections= new ArrayList<String[]>();
static final ArrayList sections= new ArrayList();
private static String convert (final String s) {
String temp = s;
//replaces the defined section keywords with a unique section code identifier(3 Bits)
final Iterator<String[]> sic = sections.iterator();
while (sic.hasNext()) {
final String[] val = sic.next();
temp = temp.replaceAll("\n(" + val[1] + ")\r?\n--*\r?\n", val[0].length()>0 ? "\n\u25b4\u25ba"+val[0]+"\n$1\n": "\n\n\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
}
return (temp + "\u25b4").replaceAll("\u25ba212(\n" + ratioRam +"\u25b4)","\u25ba222$1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
// in another part, the file sections are read. : readList(sections) ;