How do I use a StringBuffer as an array?
hello!
new problem today. I have a StringBuffer named protocols and I want to go trough it and depending on what it contains to display some Strings.
Here is the code:
...
protocols =new StringBuffer("ITUCAR");
....
for (int i=0;i<protocols.length();i++){
if (protocols[i].toString()==""){
textArea.append("");
}
elseif (protocols[i]=="I"){
textArea.append("IP"+"\n");
}
elseif (protocols[i]=="T"){
textArea.append("TCP"+"\n");
}elseif (protocols[i]=="U"){
textArea.append("UDP"+"\n");
}elseif (protocols[i]=="C"){
textArea.append("ICMP"+"\n");
}elseif(protocols[i]=="A"){
textArea.append("ARP"+"\n");
}elseif (protocols[i]=="R"){
textArea.append("RARP"+"\n");
}
}
I get an error saying "array required but StringBuffer found! :(...
what am I doing wrong?
thank you for lending a helping hand!
Cristina//half of month more till diploma :(>

