Thursday, 22 August 2013

How can I implement a program that scrolls a string, and for each ocurrence of a letter place the ocurrence in uppercase?

How can I implement a program that scrolls a string, and for each
ocurrence of a letter place the ocurrence in uppercase?

What I need to do is to Implement a program that receives a string A and
any letter t. Scroll through each character of the string and for each
occurrence of the letter of t entry, place in uppercase each occurrence in
the string.
Then I did this:
import javax.swing.JOptionPane;
import java.lang.Character;
/**
*
* @author Santiago
*/
public class LecturaCaracteres {
public static void main(String args[])
{
String A=JOptionPane.showInputDialog("Introduce la palabra");
char s[]=A.toCharArray();
for(int i=0; i< s.length; i++ )
{
s[i]=(char) i;
String t="t";
if (s.equals(t)) {
s.toUpperCase();
System.out.println(s);
}
}
}
}
If anyone can help me with this, I will be grateful.

No comments:

Post a Comment