Difference in a string and the text retrieved from JTextBox

Hello,
I am facing a peculiar problem. Please see the following code fragment:
m.replaceAll(";\ngo;);
where m is a matcher. This is working fine. But whenever I am doing
m.replaceAll(myTextBox.getText());
and placing ";\ngo;" in the text Field is not working as before. This is because that getText() returns a string in text form(doesnot take the newline into consideration). Any idea how to solve this?
Regards,
Saurav

Here is the following code:
File fin = new File(file);
File fout = new File("C:\\Temp\\temp123.txt");
FileInputStream fis = new FileInputStream(fin);
FileOutputStream fos = new FileOutputStream(fout);
BufferedReader in = new BufferedReader(new InputStreamReader(fis));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(fos));
Pattern p = Pattern.compile(find);
Matcher m = p.matcher("");
String aLine = null;
while((aLine = in.readLine()) != null) {
m.reset(aLine);
String result = m.replaceAll(replace);
out.write(result);
out.newLine();
in.close();
out.close();
What I intend to do is that the user will provide a fileName from the GUI and also the text to find and the text to repalce with. Both of them will be in a JTextBox. Now
suppose I want to replace ";" in the line "Hello;" with ";\nHow are u?" so that the line looks like
"Hello;
How are u?"
But what is happening is that the line looks like
"Hello;\nHow are u?" after replacement.
This happens because getText() doesnot considers that as a special character...
I tried to harcode the replace string and it worked perfectly....
Thats the problem.....I need the same behaviour with getText().
Regards,
Saurav

Similar Messages

  • What is the difference between Macs Voice Over and the text to talk feature

    what is the difference between Macs Voice Over and the text to talk feature

    Voice Over doesn't need someone to type in the text first. Voice Over works with specific screen displayed information so that a blind person can know where his/her cursor is or what is being displayed. Although it is an application of text to talk it's more than the text to talk feature.

  • Difference between null string and empty string??

    what is the major difference between null string and an empty string??
    I wrote the following simple program and I could see some different output.
    Other than that, any other differences that we should pay attention to???
    C:\>java TestCode
    Hello
    nullHello
    public class TestCode
         public static void main(String[] s)
         {     String s1 = "";
              String s2 = null;
              System.out.println(s1 + "Hello");
              System.out.println(s2 + "Hello");
    }

    The difference is that an empty String is just empty but a null String has no value (i.e. it is not instantiated) this has signifigance since all Strings are objects.

  • Finding the value of the text starting from x1 and ending at x2

    Dear All,
    While reading a notepad's each line, I need to take the each lines value starting from say 15th position to 20th position. If i use it_notepad-text+14(5) and the text does not contains any data, it generates dump.
    pl. guide. Is there any function module to get the value of the string with starting and ending position.
    Regards,
    Vidhya

    I think the best is what G@urav suggested. Simple catching this exception will solve your issue
    data: word type string.
    loop at it_notepad.
       try.
           word = is_notepad-text+11(4). "get the required word
       catch cx_sy_range_out_of_bounds.  "and catch the exception in case the word is too short
       endtry.
    endloop.
    This way you won't get dump and will be able to skip the line which don't have required number of chars.
    Regards
    Marcin

  • I have an iphone 4s and the text i send to a friend with a galaxy 4s he is not receiving any help?

    i have an Iphone 4S and the text i send to a friend with a galaxy 4s he is not receiving. Any help?

    Then it's sending as SMS and not iMessage (that's good) so deleting the contact probably didn't help. It also seems iMessage isn't redirecting his texts as he's not used and apple device on the account previously. Can he receive a picture message from you instead? Does he receive texts from other  apple devices? (iPhones,pods/pads) try sending a text through Verizon online using your account on a web browser. If it is also blocked then it confirms the issue is with his device, well at least points you there rather than guessing if it's yours or his or both. There's some ideas, let me know- Joe
    Sent from my iPhone

  • Is there a way to increase the icon size (and the text below) without using zoom?  I am trying to help out someone who has moderate visual impairment that does not want to use zoom just to see the icons and their labels.

    Is there a way to increase the icon size (and the text below) without using zoom in iOS 7?  I am trying to help out someone who has moderate visual impairment that does not want to use zoom just to see the icons and their labels.

    Hello Apple.
    It seems you have gone to great lengths to improve accessibility in many areas of the iPad. Why was this obvious problem with icon text size missed?  (It's not with the Mac.). And for so long too.
    Do you employ people with actual accessibility problems to help you do UI design?
    I think too, that some buttons are too close for people who might have motor control problems.
    I love my iPad but I fear as I age, the iPad might not keep up with me.

  • The icons in the bookmark tool bar are blank and the text that use to be below the icon is gone. I now have to cursor over the blank icons to see the text and the one I want. Can the icon/text customization be returned?

    In the Navigation Toolbar, the icons "Back", "Forward" etc. show the small icon and the descriptive text below the Icon. My Bookmark Toolbar use to have the same icon/text format but at some point, possibly a browser update, that changed. Currently, I do have a visible Bookmark Toolbar BUT the icons do not show the website icon, as previously, and the text below each icon is gone. I an cursor over each icon and the text becomes visible next to the icon. This is a bit of a pain to find a bookmark. Can I do a customization to return to the icon/text format.
    Was this changed because browser users requested this option, or was it an internal decision.? If the later why make such changes when not requested?
    Ed Sander

    That wasn't a change in Firefox. It sounds like something is broken in your Firefox installation, or you are misunderstanding the different between the Bookmarks Toolbar and the other Toolbars.
    In the Bookmarks Toolbar the text appears next to the website icon, not below the icon as with the other two Toolbars, and it's not switchable between text and no text as with the other Toolbars. With both the bookmark icon and the Bookmark name missing, something is broken in your installation. You need to do a little troubleshooting.
    Do you have that problem when running in the Firefox SafeMode? <br />
    [http://support.mozilla.com/en-US/kb/Safe+Mode] <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    If not, see this: <br />
    [http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes]
    If your problem isn't related to an extension, your bookmarks data base file (places.sqlite) is probably corrupt. <br />
    http://kb.mozillazine.org/Locked_or_damaged_places.sqlite <br />
    Be aware that if you delete the "places.sqlite" and similar files, your bookmark website icons won't automatically appear (the JSON backups don't have that icon data) when you restart Firefox and the places.sqlite is rebuilt using the backup data file, but the icons should be saved the first time each bookmark is used for the first time.

  • When I send a text using siri the recipient shows that the text came from my email. How do I fix that so it show that the text came from my phone number and not my email address?

    When I send a text using siri the recipient shows that the text came from my email. How do I fix that so it show that the text came from my phone number and not my email address?

    Settings > Messages > Send & Receive > Start new conversations from:
    Only your phone number is selected.

  • How do I change the size of the tools and the text for the menus in Photoshop?  I need a magnifying glass in order to make out what they are.

    How do I change the size of the tools and the text for the menus in Photoshop?  I need a magnifying glass in order to make out what they are.

    Okay, I've figured it out, so I'm going to answer my own question in hopes that it may help anyone else that would like to actually be able to see what they're doing when using Photoshop CC 2014 on a high resolution screen.
    1.  Open Photoshop.
    2.  Select Preferences from the Edit Menu, then select General.
    3.  Change the HUD Color Picker to Hue Strip (Medium).
    4.  Select Interface from the Preferences menu on the left side of the dialog box.
    5.  Change the UI Font Size to Large in the Text area of the Preferences dialog box.
    6.  Select Experimental Features from the Preferences menu on the left side of the dialog box.
    7.  Select Scale UI 200% for high-density displays (Windows only).
    8.  Click on OK, then Exit/Quit Photoshop.
    9.  Open Photoshop and everything should be readable.

  • I just started using a new version of Illustrator and the text I am creating has a pink box behind, looks to be about the depth of the normal linespace, it is not visible in outline view, only in preview. What is it and how do I get rid of it?

    I just started using a new version of Illustrator and the text I am creating has a pink box behind, looks to be about the depth of the normal linespace, it is not visible in outline view, only in preview. What is it and how do I get rid of it?

    Hi Larry. I see. It is a file I have worked on previously, and the font is Myriad which I though came with the system. I just changed to Myriad Pro and the pink box disappeared. Thanks for the assistance, I know a new thing!

  • What's the difference between Java SDK and the Enterprise Edition?

    What's the difference between Java SDK and the Enterprise Edition? Are they both free?

    both r free but they are used in diffrent applications. sdk are used for simple apps that run on your computer while j2e (enterprise edition) are ment for large distributed computer systems that include servers and such. if you don't know the diffrence you probably wont need the the j2e, only the sdk.

  • So I have been creating a logo for my company and it came out great. The problem is, when I format it for PNG or when I want to use it on freshbooks or my webpage, the image becomes blurred and the text is not as clear. How do I fix this?

    So I have been creating a logo for my company and it came out great. The problem is, when I format it for PNG or when I want to use it on fresh books or my webpage, the image becomes blurred and the text is not as clear. How do I fix this? Is it because the text get shrunk?

    This is how it looks on adobe illustrator

  • I have just installed Lion and the text window for the web address in safari has disappeared.  Anyone know how to get it back?

    I have just installed Lion and the text window for web addresses in safari has disappeared.  Any ides how to getit back?

    Select Customize Toolbar from the View menu, select the item and drag into the toolbar. Place where you want it to be.

  • I am converting a .docx file to a pdf and the text is coming out blurry

    I am trying to convert a .docx file to a pdf and the text keeps coming out blurry. Some sentences seem to be bolded in the pdf as well. All the colored text seems like there's a shadow behind it and all the text in bold seems extra blurry. I am saving the file as a pdf. I tried to print the file as a pdf but it kept crashing. I have adobe acrobat pro and distiller, but I'm not savy about which program does what.
    Thanks for any help!

    If you are trying to convert a Word file, ensure the text is in 100% black only.
    To create PDF's there are hundreds of different combinations that can be used, but only a few will give you a good 'print ready' file, which is what I think you may be after.
    You may have font issues that are stopping the text looking sharp.
    If you have Distiller, you can try to print as .ps (save as postscript), load distiller up and choose one of the high quality settings in the pop down menu.
    If you are working on a Mac you can drag and drop the .ps file direcetly on the dock icon for distiller, or if you are running Windows you will need to navigate to the file via the menu bar (you will need to know where you have saved your .ps file).
    There may be other issues with the original file format that is causing problems with your PDF creation.
    Let me know how you get on.
    Cheers

  • I ask the third time: How can I enlarge the menue symbols and the text of the menue in Photoshop CS6 vers.13 so that I can read them??? My laptop has Win 8.1 and a screen resolution of 3840x2160

    I ask the third time:
    How can I enlarge the menue symbols and the text of the menue in Photoshop CS6 vers.13 so that I can read them??? My laptop has Win 8.1 and a screen resolution of 3840x2160.
    It is unbelievable that such an expensive software does not provide a proper lay out wit a high screen resolution!
    It is also unbelivable that it is not possible to get a qualified employee of ADOBE on the phone in Germany.
    hope of feed back: e-mail: [email protected]

    Chris Cox answered your question here:
    I have PS cs6 extended and a new laptop with screen resolution of 3840x2160. Now all control elements and menues are so small that I can not reed them. How can I make them readable without reducing the resolution of the schreen?

Maybe you are looking for

  • Pages 5.1 truncates text in tables

    Just discovered that Pages 5.1 truncates text in tables when exported to Pdf's even when created in Numbers and pasted. Superscripts were missing. Sometimes regular text after superscrips were missing. Too bad.

  • Any updated to iOS 7.1 with a 5s; how did it go?

    Hi all, I have been waiting and watching to see if there have been any issues with updating to iOS 7.1 with an iPhone 5s. In the past, I have gotten burned with updating my iPad to a newer iOS namely poorer battery life, etc. Our iPhones are only two

  • Itunes hangs apon opening

    Hi, this is my first time installing Itunes on my Laptop running on Windows Vista. The installation completed successfully but Itunes seems to hang right after i open the program for some reason. I've tried uninstalling and reinstalling a couple of t

  • I have lost my camera icone and my camera is not working how to resolve the same.

    Hi Team, Camera on 3gs is not working its d't show the display and i have lost its icon on task manager kindly provide me detail hw can i resolve the same. Also one of my iphone in which i have faced charging issue phone is not charged kindly help me

  • Unkown error when trying to log in id

    unkown error when trying to log in id for app store or app download. please help