Connecting Tech Pros Worldwide Help | Site Map

How to convert a TextArea to a String?

Newbie
 
Join Date: Oct 2009
Posts: 2
#1: Oct 16 '09
I need to convert a TextArea to a String, and the replace the letter "a" in the string by a "f";
I have:
JTextArea Text1 = new JTextArea();
String Text2;
???????? here's where i convert the textarea to a srting ??????????
Text2 = null;
Text2 = Text1.replaceAll("a", "e");

I haved tried:
String Text2 = CriptoText.getElementById("Text1");

Thank you for your help
Lives Here
 
Join Date: Sep 2006
Posts: 12,070
#2: Oct 16 '09

re: How to convert a TextArea to a String?


Read the API specs for the classes you are using rather than cross posting the same question on many forums.
Newbie
 
Join Date: Oct 2009
Posts: 2
#3: Oct 16 '09

re: How to convert a TextArea to a String?


Quote:

Originally Posted by r035198x View Post

Read the API specs for the classes you are using rather than cross posting the same question on many forums.

I already sis but i cant really understand thats why i ask, and if i have 100 thousand forums with the same quiestion is my problem i want a respond thats why i do it...And i only have 2 forums with the same question...
Newbie
 
Join Date: Oct 2009
Posts: 9
#4: 4 Weeks Ago

re: How to convert a TextArea to a String?


Are you trying to convert JtextArea() object in to a string or something else?
Newbie
 
Join Date: Jul 2009
Posts: 17
#5: 4 Weeks Ago

re: How to convert a TextArea to a String?


Haven't tested it, but quite sure this works:

Expand|Select|Wrap|Line Numbers
  1. JTextArea TextArea = new JTextArea();
  2. String text1 = TextArea.getText();
  3. String text2 = text1.replaceAll("a", "e");
Reply