Reputation: 31
I have the following code which is changing the text I am inputting to UPPERCASE
if(WrtMsg.isDisplayable()== true); {
//System.out.println(test.toString().toUpperCase());
RecView.setText(test.toString().toUpperCase());
}
Now I want special characters like asterix (*) to be changes as text. Example *
to ATX
... So the output will be displayed as ATX
.
WrtMsg
is the jtextarea
of text input and RecView
is the jtextarea
where the output is showing.
Any help please? Thanks.
Upvotes: 0
Views: 940
Reputation: 13252
Have you considered manually changing it in code? You could create a method like this:
private String charToText(String character) {
character = character.replace("*", "ATX")
// and so forth...
return character;
}
Upvotes: 1
Reputation: 39217
You should use the replace method of the string object
test.toString().toUpperCase().replace("*", "ATX")
Upvotes: 0
Reputation: 23248
Just use the replaceAll
method of the String
class. something.replaceAll(Pattern.quote("*"), "ATX")
.
Upvotes: 1