Help on how to treat the \'  string ?

Hi,
i have a string which i have to save it to a file. It happens that the string can contains \' (2 chars = \ and ' )
I save it to a file performing:
try {
FileOutputStream fos = new FileOutputStream(aFileName);
Writer out = new OutputStreamWriter(fos, "UTF8");
out.write(cadena);
out.close();
catch (IOException eIO){
eIO.printStackTrace();
And i read it from the file:
StringBuffer buffer = new StringBuffer();
try {
     FileInputStream fis = new FileInputStream(aFileName);
     InputStreamReader isr = new InputStreamReader(fis,"UTF8");
     Reader in = new BufferedReader(isr);
     int ch;
     while ((ch = in.read()) > -1) {
buffer.append((char)ch);
     in.close();
     return buffer.toString();
} catch (IOException e) {
     e.printStackTrace();
     return null;
After reading the file the contents does not include the \' string just ' only. The \ is missing and obviously
it is not the same string previously saved.
How can i solve this problem? Early I suspected the problem was saving to the file with out.write(cadena); so i replace the code with another which saves char by char the string but with the same final result.
Many thanks in advance,
Marla.

Escape characters. Okey.
This is the string R\'U*��� how can i do to insert a \ before the one in the string ?
That is my problem?
Thanks.

Similar Messages

  • How to prevent the String Tokenizer filter more than one character

    I am wrinting a simple program to cut the long string into small piece of data with the delimiters "#####" by using StringTokenizer
    For example:
    String output ="Apple Company #####APPLECOMPANY48877 #####2005-01-01 #####TESTING1 ##### ##### ##### ##### #####MR.Apple Wong #####[email protected] #####0-852-34183741 #####0-852- #####XYZ #####Apple in the tree road #####ROOM 3T099, LEVEL 9, All WIN BLDC ##### ##### #####NT #####34KJFG45 |||||0.0000 |||||1 |||||3 |||||3";
    StringTokenizer st = new StringTokenizer(output,"#####");
    int i=0;
    while(st.hasMoreTokens()){
    System.out.println("The number is: " i" "+st.nextToken());
    i++;
    The result is
    The number is: 0 Apple Company
    The number is: 1 APPLECOMPANY48877
    The number is: 2 2005-01-01
    The number is: 3 TESTING1
    The number is: 4
    The number is: 5
    The number is: 6
    The number is: 7
    The number is: 8 MR.Apple Wong
    The number is: 9 [email protected]
    The number is: 10 0-852-34183741
    The number is: 11 0-852-
    The number is: 12 XYZ
    The number is: 13 Apple in the tree road
    The number is: 14 ROOM 3T099, LEVEL 9, All WIN BLDC
    The number is: 15
    The number is: 16
    The number is: 17 NT
    The number is: 18 34KJFG45 |||||0.0000 |||||1 |||||3 |||||3----->
    It is correct!!!!!!
    But, if the one of the small string in the long string contain the character "#", I found the "#####" and "#" also trace as delimiters by StringTokenizers to filter the String such as following example:
    I only add one more "#" in String "ROOM 3T099, LEVEL 9," from the above example:
    String output ="Apple Company #####APPLECOMPANY48877 #####2005-01-01 #####TESTING1 ##### ##### ##### ##### #####MR.Apple Wong #####[email protected] #####0-852-34183741 #####0-852- #####XYZ #####Apple in the tree road #####ROOM #3T099, LEVEL 9, All WIN BLDC ##### ##### #####NT #####34KJFG45 |||||0.0000 |||||1 |||||3 |||||3";
    StringTokenizer st = new StringTokenizer(output,"#####");
    int i=0;
    while(st.hasMoreTokens()){
    System.out.println("The number is: " i" "+st.nextToken());
    i++;
    But the result is:
    The number is: 0 Apple Company
    The number is: 1 APPLECOMPANY48877
    The number is: 2 2005-01-01
    The number is: 3 TESTING1
    The number is: 4
    The number is: 5
    The number is: 6
    The number is: 7
    The number is: 8 MR.Apple Wong
    The number is: 9 [email protected]
    The number is: 10 0-852-34183741
    The number is: 11 0-852-
    The number is: 12 XYZ
    The number is: 13 Apple in the tree road
    The number is: 14 ROOM
    The number is: 15 3T099, LEVEL 9, All WIN BLDC
    The number is: 16
    The number is: 17
    The number is: 18 NT
    The number is: 19 34KJFG45 |||||0.0000 |||||1 |||||3 |||||3
    I have found that the StringTokenizer trace "#####" and "#" to be delimiters to filter the String, I only want to filter the String by StringTokenizer with "#####" not include "#"
    So What Can I Do? Is it
    StringTokenizer st = new StringTokenizer(output,"#####");
    not Correct?
    It is thank a lot if anyone can help me! thx!!

    If I must use StringTokenizer, How can I do it? You completely misunderstand how StringTokenizer works.
    StringTokenizer st = new StringTokenizer(output,"#####");Each character is used as a delimiter. So you have specified the same delimiter 5 times.
    As suggested above you would need to rewrite the entire code, to treat the String as a delimiter, intead of each character as a delimiter.

  • How to split the string by datetime in sql

    Hi,
    How to split the string by datetime in sql, I've a table with comments column stores comments by datetime, while selecting I want to split and show as in rows by each jobref.
    can anyone help me in this please.
    Thanks,

    declare @callcentre table (comments varchar(max),lbiref varchar(200))
    insert into @callcentre
    select '(28/10/2014 14:56:14) xyz ..... call  logged   (28/10/2014 14:56:58) xyz ..... call updated   (28/10/2014 14:57:41)xyz ..... call updated','Vi2910201'
    insert into @callcentre
    select '(29/10/2014 14:56:14) xyz ..... call  logged   (29/10/2014 14:56:58) xyz ..... call updated   (29/10/2014 14:57:41)xyz ..... call updated','Vi2910202'
    insert into @callcentre
    select '(30/10/2014 14:56:14) xyz ..... call  logged   (30/10/2014 14:56:58) xyz ..... call updated  
    output:
    1) 28/10/2014 14:56:14, (28/10/2014 14:56:14) xyz ..... call  logged ,'Vi2910201'
     2) 28/10/2014 14:56:58 ,(28/10/2014 14:56:58) xyz ..... call updated ,'Vi2910201'
    3) 28/10/2014 14:57:41,  (28/10/2014 14:57:41)xyz ..... call updated,'Vi2910201'
    4) 28/10/2014 14:56:14, (28/10/2014 14:56:14) xyz ..... call  logged ,'Vi2910202'
     5) 28/10/2014 14:56:58 ,(28/10/2014 14:56:58) xyz ..... call updated ,'Vi2910202'
    6) 28/10/2014 14:57:41,  (28/10/2014 14:57:41)xyz ..... call updated,'Vi2910202'
    7) 28/10/2014 14:56:14, (28/10/2014 14:56:14) xyz ..... call  logged ,'Vi2910203'
     8) 28/10/2014 14:56:58 ,(28/10/2014 14:56:58) xyz ..... call updated ,'Vi2910203'
    Thanks,
    See this illustration
    declare @callcentre table (comments varchar(max),lbiref varchar(200))
    insert into @callcentre
    select '(28/10/2014 14:56:14) xyz ..... call logged (28/10/2014 14:56:58) xyz ..... call updated (28/10/2014 14:57:41)xyz ..... call updated','Vi2910201'
    insert into @callcentre
    select '(29/10/2014 14:56:14) xyz ..... call logged (29/10/2014 14:56:58) xyz ..... call updated (29/10/2014 14:57:41)xyz ..... call updated','Vi2910202'
    insert into @callcentre
    select '(30/10/2014 14:56:14) xyz ..... call logged (30/10/2014 14:56:58) xyz ..... call updated','Vi2910203'
    SELECT LEFT(p.u.value('.[1]','varchar(max)'),CHARINDEX(')',p.u.value('.[1]','varchar(max)'))-1) AS [Date],
    '(' + p.u.value('.[1]','varchar(max)') AS comments,
    lbiref
    FROM
    SELECT lbiref,CAST('<Root>' + STUFF(REPLACE(comments,'(','</Data><Data>'),1,7,'') + '</Data></Root>' AS XML) AS x
    FROM @callcentre c
    )t
    CROSS APPLY x.nodes('/Root/Data')p(u)
    and the output
    Date comments lbiref
    28/10/2014 14:56:14 (28/10/2014 14:56:14) xyz ..... call logged Vi2910201
    28/10/2014 14:56:58 (28/10/2014 14:56:58) xyz ..... call updated Vi2910201
    28/10/2014 14:57:41 (28/10/2014 14:57:41)xyz ..... call updated Vi2910201
    29/10/2014 14:56:14 (29/10/2014 14:56:14) xyz ..... call logged Vi2910202
    29/10/2014 14:56:58 (29/10/2014 14:56:58) xyz ..... call updated Vi2910202
    29/10/2014 14:57:41 (29/10/2014 14:57:41)xyz ..... call updated Vi2910202
    30/10/2014 14:56:14 (30/10/2014 14:56:14) xyz ..... call logged Vi2910203
    30/10/2014 14:56:58 (30/10/2014 14:56:58) xyz ..... call updated Vi2910203
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to Splilit The String Into Single Column using Comma As Delimiter ?

    How to Splilit The String Into Single Column using Comma As Delimiter ?
    using Function

    refer my thread ,code is also available see if that helps you
    error while executing the sp ORA-21779: duration not active

  • How to transfer file from ipod touch to i tunes. i have files in my ipod , ut itunes is  new so its telling if u sync the ipod all the files will be replaced but no files in the itunes.. so kindly help me how to transfer the files  from i pod to itunesb

    how to transfer file from ipod touch to i tunes. i have files in my ipod , ut itunes is  new so its telling if u sync the ipod all the files will be replaced but no files in the itunes.. so kindly help me how to transfer the files  from i pod to itunes......

    Some of the information below has subsequently appeared in a document by turingtest2: Recovering your iTunes library from your iPod or iOS device - https://discussions.apple.com/docs/DOC-3991
    Your i-device was not designed for unique storage of your media. It is not a backup device and media transfer was designed for you maintaining a master copy of your media on a computer which is itself properly backed up against loss. Syncing is one way, computer to device, updating the device content to the content on the computer, not updating or restoring content on a computer. The exception is iTunes Store purchased content.
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer - http://support.apple.com/kb/HT1848 - only media purchased from iTunes Store
    For transferring other items from an i-device to a computer you will have to use third party commercial software. Examples (check the web for others; this is not an exhaustive listing, nor do I have any idea if they are any good):
    - Senuti - http://www.fadingred.com/senuti/
    - Phoneview - http://www.ecamm.com/mac/phoneview/
    - MusicRescue - http://www.kennettnet.co.uk/products/musicrescue/
    - Sharepod (free) - http://download.cnet.com/SharePod/3000-2141_4-10794489.html?tag=mncol;2 - Windows
    - Snowfox/iMedia - http://www.mac-videoconverter.com/imedia-transfer-mac.html - Mac & PC
    - iexplorer (free) - http://www.macroplant.com/iexplorer/ - Mac&PC
    - Yamipod (free) - http://www.yamipod.com/main/modules/downloads/ - PC, Linux, Mac [Still updated for use on newer devices? No edits to site since 2010.]
    - 2010 Post by Zevoneer: iPod media recovery options - https://discussions.apple.com/message/11624224 - this is an older post and many of the links are also for old posts, so bear this in mind when reading them.
    Syncing to a "New" Computer or replacing a "crashed" Hard Drive - https://discussions.apple.com/docs/DOC-3141 - dates from 2008 and some outdated information now.
    Copying Content from your iPod to your Computer - The Definitive Guide - http://www.ilounge.com/index.php/articles/comments/copying-music-from-ipod-to-co mputer/ - Information about use in disk mode pertains only to older model iPods.
    Get Your Music Off of Your iPod - http://howto.wired.com/wiki/Get_Your_Music_Off_of_Your_iPod - I am not sure but this may only work with some models and not newer Touch, iPhone, or iPad.
    Additional information here https://discussions.apple.com/message/18324797

  • How to capture the string values

    Hi Gurus,
    Could you plz suggest me how to capture the string value.
    My requirement is.
    I have a structure field called  cnj_stat-sttxt_int and it is storing a value like "REL CDRT AVAC". AND the moddile value CDRT will change according to condtions. now i required to write a logic like if cnj_stat-sttxt_int field contain 'REL' and 'AVAC'.  I HAVE TO THROW SOME ERROR.
    SO please give some idea about on it...
    Its urgent..
    points will be rewarded...
    Thanks in advance!!!!
    Thanks & regards,
    Kranthi.

    if cnj_stat-sttxt_int field contain 'REL' and 'AVAC'. I HAVE TO THROW SOME ERROR.
    if cnj_stat-sttxt_int CS 'REL' and cnj_stat-sttxt_int CS 'AVAC'.
    THROW SOME ERROR.
    endif.

  • Please help me how to take the "Spot Color" in illustrator?

    Hi,
    Please help me how to take the "spot color in illustrator CS" using vb script (or) java script.
    Regards,
    Prabudass E.

    Prabudass,<br /><br />If you are just wanting to see if the illustrator file uses spot colors - run the Delete Unused Panel items from the default actions. then view the swatch palette in small or large List View. The color names that have a square containing a gray circle (spot) to the right of their color names are spot colors. <br /><br />The following will get the spot color name of an existing swatch named "Color1" and change it to "Nicks Swatch" and will assign the CMYK values stated.<br /><br />if (app.documents.length > 0){<br />var swatches = app.activeDocument.spots;<br />for(i=0;i<swatches.length;i++){ var currSwatch = swatches[i]; if(currSwatch.name == "Color1")<br />{currSwatch.name = "Nicks Swatch";<br />     var newColor = new CMYKColor(); <br />     newColor.cyan = 35; newColor.magenta = 0; <br />     newColor.yellow = 50; <br />     newColor.black = 0; <br />     currSwatch.color = newColor; } }}<br /><br />When this script has run the swatch palette will not immediately reflect the changes to the swatch name until you double click on a swatch and click OK or Cancel in the Edit Swatch dialog.<br /><br />I hope that I have understood your question correctly and that these responses are helpful.<br /><br />Good Luck<br /><br />Nick

  • Please help me how to improve the performance of this query further.

    Hi All,
    Please help me how to improve the performance of this query further.
    Thanks.

    Hi,
    this is not your first SQL tuning request in this community -- you really should learn how to obtain performance diagnostics.
    The information you posted is not nearly enough to even start troubleshooting the query -- you haven't specified elapsed time, I/O, or the actual number of rows the query returns.
    The only piece of information we have is saying that your query executes within a second. If we believe this, then your query doesn't need tuning. If we don't, then we throw it away
    and we're left with nothing.
    Start by reading this blog post: Kyle Hailey &amp;raquo; Power of DISPLAY_CURSOR
    and applying this knowledge to your case.
    Best regards,
      Nikolay

  • Please help me how concatenate all the error messages and send it as out parameter value.

    Hi Experts,
    Please help me how concatenate all the error messages and send it as out parameter value.
    Thanks.

    Agree with Billy, exception handling is not something that is done by passing parameters around.
    PL/SQL, like other languages, provides a suitable exception handling mechanism which, if used properly, works completely fine.  Avoid misuing PL/SQL by trying to implement some other way of handling them.

  • I have an itouch, most songs i got off my cd's. i have a new laptop and want to put songs from itouch to laptop.I can only get the songs that i purchased onto the laptop? need help with how to get the rest from itouch to laptop please??

    i have an itouch, most songs i got off my cd's. i have a new laptop and want to put songs from itouch to laptop.I can only get the songs that i purchased onto the laptop? need help with how to get the rest of the songs (from my cd's) from itouch to laptop please??

    See this previous discussion:
    Recovering your iTunes library from your iPod or iOS device: Apple Support Communities

  • How To Split the String for "."

    Hi Friends
    I am Using Following Code to Split one String.
    String str = "Jeetendra.choudhary";
    String[] sp_str = str.split(".");
    wdComponentApi.getMessageManager.reportSuccess(str[0]);
    wdComponentApi.getMessageManager.reportSuccess(str[1]);
    but its throwing null pointer exception. 
    when i am using following code its working fine.
    String str = "Jeetendra/choudhary";
    String[] sp_str = str.split("/");
    wdComponentApi.getMessageManager.reportSuccess(str[0]);
    wdComponentApi.getMessageManager.reportSuccess(str[1]);
    what may be the issue and how to split the string with "." ?
    Thanks & Regards
    Jeetendra

    "." is a special character.
    Use
    str.split("\\.");
    Regards
    Benjamin
    Edited by: Benjamin Hansen on Dec 29, 2009 7:52 AM

  • TS1538 hi guys!merry christmas! i hope you can help me how to reinstali the apple mobile device in my  computer..

    hi guys!merry christmas! i hope you can help me how to reinstali the apple mobile device in my  computer..

    Type "Apple mobile device service" into the search bar at the top of this page by Support and read the resulting help articles.

  • I have an Apple I Phone 4S which is great but, can someone help me how to get the photos and videos to my PC which runs on MS XP. I would like to be able to edit and copy to a DVD.

    I have an Apple I Phone 4S which is great but, can someone help me how to get the photos and videos to my PC which runs on MS XP. I would like to be able to edit and copy photos and videos to a DVD.

    Connect your iPhone to your computer. Tp your pc should recognize your iPhone as a camera. Use what ever application you have on the pc to transfer files from a camera to your computer.

  • How to read the string present in the captcha?

    hi all,
    Can anyone help me out to read the string present in the captcha.
    When a user registers an ID or stuff the user is prompted to enter the image shown.
    i need a code to read the string present in the captcha image.
    hope u get my point.please help me out in coding out for the above.
    Thanks,
    vish

    so dude basically u r trying to make a spam engine?!
    do u think any1 would help u here ? lol
    by the way why do u really need that code ? what are ur intentions ? lol

  • General Q: How to treat the battery

    Hi,
    I've recently ordered a customized X61 with 8-cell battery and I would like to know what the best way to treat the battery is.
    I tried googling it, but there doesn't seem to be a definite answer so I decided to ask it here...
    So the Q is, what's should be done to the battery when using AC, possibly for a long time..should it be removed? If yes, is it better to have it removed when fully charged, or around half-way (or 40%, as mentioned elsewhere)?
    I also had a vaio notebook before, and from experience, I could tell that my battery pretty much wore out in about a year, when using AC power almost 100% of the time and keeping the battery inside.
    Thanks!

    Hello polarbear,
    first load your battery 36h long, then discharge it, then load for 24h, then discharge it, then load for 12h and discharge.
    After that, your battery knows, when it is totally full and is therefore calibrated.
    second a Thinkpad has got a program called Energy Manager.
    This controls your charging levels of your battery. I have set it to automatic and the TP is always on AC with 
    batttery pack installed, but you set the charging levels by your own.
    Result: My battery has got 72 loadcycles after one and a half year, and has got it´s full capacity!!! 56,16 Wh!
    Sometimes even more. No battery wear so far!
    But this is just my opinion how to treat the Tp´s battery pack. Others may vary.
    Follow @LenovoForums on Twitter! Try the forum search, before first posting: Forum Search Option
    Please insert your type, model (not S/N) number and used OS in your posts.
    I´m a volunteer here using New X1 Carbon, ThinkPad Yoga, Yoga 11s, Yoga 13, T430s,T510, X220t, IdeaCentre B540.
    TIP: If your computer runs satisfactorily now, it may not be necessary to update the system.
     English Community       Deutsche Community       Comunidad en Español

Maybe you are looking for

  • How to fetch the BCC address using java mail

    Hi, I want to extract the mail address given in the Bcc address field of an email which I fetch it from the IMAP store !! I will be very much thankful if this problem is solved !! Thanks!!

  • Open items missing in F-44 compared to FBL1N

    Hello all My user is attempting to do a routine clearing of a vendor account using the f-44 transaction. However, when they run the transaction it does not display all open items on the vendor account (as seen in fbl1n run for open items). there are

  • How to make my website logo show as the new Yosemite favourites icon?

    I've been searching high and low for the answer to this question so I hope someone maybe able to help me. When you click in the address bar in safari using Yosemite you get the icons from the websites that you have as a favourite. Some, like Facebook

  • Process Color to Spot in a PDF??

    Hello, so I have a PDF file that is 100pages for example. This only has black text and nothing else. How can I convert this black process text to spot?? Not page by page such as in Illustrator but all pages together and then export again as PDF with

  • HT4236 I can't see any photos when ipad is plugged into computer.

    I can't see any photos in itunes when ipad is plugged into computer. Everything else shows up.