How to delete spaces between each characters of a string in a file

In my program, I have a string, for example: str='abcdefg', when I print the string in command window, there is no space, everything is Ok But when I use the following method to write the string in a file(Mystring.txt):
File file= new File("C:\\MyString.txt");
fos = new FileOutputStream(file);
dos=new DataOutputStream(fos);
dos.writeChars(str);
when I open the file, between each character , there is a space, like "a b c d e f g", how to solve this problem? any idea or method?

The spaces appear because you are using a DataOutputStream.
In fact, a DataOutputStream uses a specific way to encode primitive types. Moreover, data written through a DataOutputStream are supposed to be read back using a DataInputStream.
You should better use a FileWriter (or an OutputStreamWriter) instead.

Similar Messages

  • Delete spaces on the right of a string of characters

    Hi,
    I'd like to know how to delete space on the right of a string of characters and ONLY the ones on the right in order I can get the real length of the string (I don't want to condense the spaces between words even though there's more than one).
    data: text(20).
    text = 'SAP Forum'
    In this case, if I use both DESCRIBE LENGTH and DESCRIBE OUTPUT LENGTH, the result will be 20, but the real length is 9.

    Use STRLEN( ), as described by the other posters.
    To delete space chars on the right of a string, use following static method:
    CALL METHOD cl_abap_string_utilities=>del_trailing_blanks
      CHANGING
         str = lv_text.

  • How can I add some space between each tab in JTabbedPane?

    I added some tabs in a JTabbedPane and want to add some spaces between each of them. How can I do this?

    There are different questions, aren't they? if you ask how to move a component to the right, and get an answer,
    then ask how to move it lower, it may seem to be a different question,
    but the concept is the same, and the answer would almost certainly
    be the same (with a tweak). Basically you should be smart enough to work
    out how to move it lower for yourself.
    if you don't understand the how concept of my response in the linked post
    relates to this post, then you're in the wrong game.
    to make it easier for you to understand
    set your own UI, overriding calculateTabHeight(..), setting whatever you want
    set your own UI, overriding paintTab(..), setting whatever you want for rects[..].x
    having pointed you to the area where you do this stuff, you should have been
    smart enough to work it out for yourself.
    at some point you will have to take your feet off the desk.

  • How do I delete space between clips in the timeline.

    I am adding several hundred photo's to the timeline. When I add them as a group, the the duration of each photo differs. I select a group of photo's, change the duration to 4.00 seconds and the clips change to 4 seconds but then there is a large space between each clip. Is there a way to select a group of clips in the timeline and have them connect to each other? How can I remove the space between clips?
    Thanks for your help.

    What you are describing happens when you have the position tool selected.
    Hit 'A' to make sure you are using the select tool (also known as the 'Arrow' tool, hence the 'A' shortcut).
    Unfortunately, your screenshots do not show which tool is active, but I am pretty convinced that that is your problem. Like Russ said, their look pretty similar to each other. But they work very differently.
    Here is a picture showing the arrow tool (in blue):
    And here is one with the Position tool (again, in blue):

  • Printing from Firefox 7 in ubuntu 11.04 jumbles up all the letters. It like has major spaces between each character. In previous Firefox, we never had this issue. Please advise

    It happens randomly. The spaces between each letter are huge. It happens on websites that you print and also in your email (webmail).
    Lets say you printing an email, then it will print and all the characters are jumbled up, then when you click reply on the same email and press print, then it print fine. It just the first time I have seen this and only since we updated to Firefox 7.
    Thank you'''bold text'''

    (1) Firefox's built-in post-crash page has not been a real HTML page for a long time (for example, from the time of Firefox 22, see: [https://support.mozilla.org/en-US/questions/968212 Want to save LOTS of versions of "Restore Session.xht" from the "oops ..." page for later use]). If you had this working differently with Firefox 25, that might have been created by an extension.
    You can check to see whether extensions are disabled or need an update on the Add-ons page. Either:
    * Ctrl+Shift+a
    * orange Firefox button (or Tools menu) > Add-ons
    In the left column, click Extensions. The disabled extensions cluster toward the bottom of the list. To poll for updates, use the "gear" button above the list and choose Check for Updates.
    If you used the Reset feature (or Firefox automatically did a reset due to some problem during upgrading), you will need to reinstall missing extensions. The reset feature creates a folder on the desktop named Old Firefox Data. Do you have that folder? There may be data you can recover from it.
    (2) There are many ways for history to get cleared, both internal to Firefox and external. Could you double-check your Privacy settings?
    orange Firefox button (or Tools menu) > Options > Privacy
    * The "Firefox will" drop-down says Remember History: Firefox shouldn't be clearing history, but an add-on or external software could do it
    * The "Firefox will" drop-down says Use custom settings for history: inspect the "Clear history when Firefox closes" setting to make Firefox isn't set to clear history. Also check your add-ons and consider external software.
    Firefox normally accumulates months of history. However, some of Firefox's database sizes are based on disk space available. If your hard drive is very full, Firefox might reduce the amount of history stored.

  • How to maintain Space between text in Smart form

    Hi Experts,
    How to maintain space between text in smat form.
    For example
    I need to maintain like this
    Prepared By:                       Passed By:                  Approved By:       
        but after save it come like this 
    Prepared By:   Passed By:  Approved By:      
    How to maintain spaces between texts?
    Regards,
    Sreedhar.

    hi,
    we can give space in the smartform in the same way as in the scripts with two commas one space can be given.
    when u click on the text in the window ,
    there in the general attributes at the left hand side u can find a small icon for editor in that u can define the spaces with the variable to be printed in &var&.

  • Indesign opens files with no space between each word, this happened after a mac update, help?? I don't want to have to go through and manually do it.

    indesign opens files with no space between each word, this happened after a mac update, help?? I don't want to have to go through and manually do it.
    thanks in advance!

    If you are unable to enter the passcode into your device, you will have to restore the device to circumvent that passcode.
    Is the music purchased from iTunes? If it is you can contact iTunes support and ask them to allow you to re-download the music that you purchased from iTunes.
    Also, do you sync the device regularly? When syncing an iPod Touch/iPhone a backup file is made. That backup file doesn't contain your music but it does contain your address book, application data, pictures, notes, etc. After restoring your device, you can try restoring from the last backup that was made of your device so you will not have to start over completely from scratch.
    Hope this helps!

  • How to add space between two tabs in accodion widget?

    Hi! I am using the accordion widgets and trying to add space between each of the tabs, would someone help me on this. Thanks

    Directly editing the output of Muse is virtually always a bad idea. At a minimum it will create a very cumbersome workflow since Muse will overwrite your changes every time you re-export (export, upload, publish, preview).
    It depends on exactly what visual effect you want to achieve, but you probably just need to select the accordion widget and use the Spacing panel to adjust the vertical gutter value.

  • How to get space between two values in a single cell of a table.

    hello,
            how to get space between two values in a single cell of a table.
    thanks a lot.
    kailash.

    sorry i got the answer.

  • Finding out how much root space does each app take...

    Hello! I was wondering if there is a way to find out how much root space does each installed app take, like a X-terminal command or something? Just want to figure out if i have some "non-optified" programmes (I believe this is the right term, but could very well be wrong) Cheers
    Solved!
    Go to Solution.

    Thaaaaats better
    Wow.. MC is a freaking space hog! 5meg of root space
    libmagic is interesting.. not sure what needs that.. it's used by software to tell what file type a file is.. it can look at a jpeg, for example and tell you it is a jpg.. clever stuff really (it doesn't use the file extension like windows) so I assume this is possibly midnight commander too..
    Out of all the extra packets you've installed, they're using 19,184,792 bytes of root space.. 18meg..
    5meg is midnight commander, 3 meg is QT3 support (not sure why you have that) and another 1.3meg is libmagic and 2 meg is some Python stuff..
    Killing off midnight commander would free some space... (why this isn't on /opt, I don't know) but realistically you've not used too much.. you should be fine!
    ---edit---
    I finished re-reading your post, not just the log file.. HA!! The funny thing is, doing this command line stuff is second nature to me.. I frequently do it in my sleep The N900 is therefore the ideal phone for someone of this disposition.. I need to find out blah statistics.. erm.. COMMAND LINE
    If you want to wander down such a particularly perverse path, I'm happy to help out and newbieness is always forgiven
    But it just shows what you can get away with using nothing more than litterally a few command line commands! pretty neat really!

  • If i have my mac mini and my mac air connected to my thunderbolt display at the same time how do I switch between each of them without unplugging one of them?

    If i have my mac mini and my mac air connected to my thunderbolt display at the same time how do I switch between each of them without unplugging one of them? (By the way im mirroring my macbook air to my thunderbolt display not dual screening it)

    That's not what home sharing is for or how it works.
    You want the remote app.

  • How to Calculate the Space between two Characters in GDI + ?

    I am Drawing the set of characters in Graphics, by Calculating the points using GraphicsPath for each Character. I Need to know how to calculate the distance should be given between the two characters?
    I am using this code to generate points
    PointF [] pnts;
    var p=new GraphicsPath();
    path.AddString("A","Arial",(int)FontStyle.Regular,50,new pointF(0f,0f),StringFormat.GenericDefault);
    Matrix m=new Matric(1,0,0,1,0,0);
    path.Flatten(m,1,0f);
    pnts=path.pathpoints;
    i am getting the points for all characters using the above code.
    Now i am combining the two character Using the points generated by the above code.  Eg "AB"
    Help me to calculate the the character space should be given between two characters?
    Thanks in Advance...

    Hi,
    this link can assist you:>
    Professional C# - Graphics with GDI+ 
    Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP]

  • How do I insert a space between each letter? i.e. ABC becomes A B C

    I have a long strand of characters that I would like to insert spaces between and doing it manually is not practical. Can anyone suggest a shortcut or a way to save me a day of sitting and hitting right arrow space bar??

    I need to turn everything into a graph where each Letter, Number and Character is in its own column.
    In this context, set up Tabulators where each and every one is defined as centered. This way, the variable set widths of the sorts (letters, glyphs) will align vertically.
    Note that if you are working with Apple Advanced Typography or Microsoft OpenType font files, your font file may have a special subset of monospaced figure (number) sorts termed Tabular.
    The monospaced figure (number) sorts may either stand on the baseline to align with UPPER CASE or have strokes ascending above and descending below the baseline to align with lower case.
    Your font file may also have other special subsets of figure (number) sorts that are proportionately spaced. You should play with these subsets to see which figures will work well for you.
    In typography (as in photography and lithography) what looks right is rights. Intelligent fonts for composition and intelligent profiles for separation are there to help you with the visuals.
    /hh

  • How to remove space between pages in Oracle Reports 6i?

    Hi,
    I have customized one oracle report (rdf). Earlier, the standard report was showing the ouput in pages i.e. there exists space beteen the pages. But I want my custom report in such a way that it should show me the result in one page i.e. there should be no space between the pages as user wants to spool the output into excel sheet (xls format) after getting the result output obtained from my custom report. Presently, when i spool the data into excel sheet, there is still the space exists between the pages like...few records will come then white space...then records.
    How can I remove this space, so that user can easily spool the data into excel without existence of white space.
    Any sort of help on this will be highly appreciated.
    Thanks & Regards,
    Sumir Chawla
    Edited by: Chawla on Jan 4, 2009 10:20 PM

    Hi,
    My report is running on Unix. When I checked the output file in unix where it is getting generated, i saw ^L characters wherever the space appears when i see the output in apps (notepad) , like after every page where I am able to see the space in my output, there ^L is appearing in output file in unix, so how can I avoid this.
    I tried to adjust the frames and repeatinf frames also, even i tried changing the properties also of main region (body), but nothing is working for me and still the same issue occurs. I am not aware of this. Please suggest me.
    Thanks a lot!
    Regards,
    Sumir

  • How to eliminate space between rows in my gallery?

    I have been trying for days to figure out how to get rid of the space between these rows. Padding and margins for the gallery as well as the rows individually have been set to zero. What are those markers (circled in red)? They seem to indicate the break between rows...
    Thanks for any help...

    There is no need to have your gallery in rows, or have each element inside it's own div with class. You can make this much cleaner by making a list - like your menu.
    Your issues were caused by the large amount of <p> tags (which have margins and padding by default) and the fact each image was wrapped in a <h2> tag (which should only be used for headings and also has a default padding and margin). Add to this the <blockquote> and you have a bit of a difficult scenario.
    I have cleaned the gallery up for you. Use the HTML below, with the CSS provided. You will need to clean up your CSS afterwards as a lot of the classes you don't need - at least for this page. Another thing is you have 3 containers for the gallery - content2, galleryframeformovie and gallery. Why? Remove the movie one and place the gallery div inside the content2 div.
    HTML
    <div id="content2"></div>
    <div id="galleryframeformovie">
      <div id="gallery">
        <ul>
          <li><a href="http://www.rhogueentertainment.com/images/2010 mm BIG/2010 big4.jpg" class="pirobox_gal1" title="4th Project Image"><img src="http://www.rhogueentertainment.com/images/2010 mm SM/2010 sm4.jpg" alt="" width="106" height="72" title="" /></a></li>
          <li><a href="http://www.rhogueentertainment.com/images/2010 mm BIG/2010 big5.jpg" class="pirobox_gal1" title="5th Project Image"><img src="http://www.rhogueentertainment.com/images/2010 mm SM/2010 sm5.jpg" alt="" width="106" height="72" title="" /></a></li>
          <li><a href="http://www.rhogueentertainment.com/images/2010 mm BIG/2010 big6.jpg" class="pirobox_gal1" title="6th Project Image"><img src="http://www.rhogueentertainment.com/images/2010 mm SM/2010 sm6.jpg" alt="" width="106" height="72" title="" /></a></li>
          <li><a href="http://www.rhogueentertainment.com/images/2010 mm BIG/2010 big2.jpg" class="pirobox_gal1" title="2nd Project Image"><img src="http://www.rhogueentertainment.com/images/2010 mm SM/2010 sm2.jpg" alt="" width="106" height="72" title="" /></a></li>
          <li><a href="http://www.rhogueentertainment.com/images/2010 mm BIG/2010 big3.jpg" class="pirobox_gal1"  title="3rd Project Image"><img src="http://www.rhogueentertainment.com/images/2010 mm SM/2010 sm3.jpg" alt="" width="106" height="72" title="" /></a></li>
            <li><a href="http://www.rhogueentertainment.com/images/2010 mm BIG/2010 big4.jpg" class="pirobox_gal1" title="4th Project Image"><img src="http://www.rhogueentertainment.com/images/2010 mm SM/2010 sm4.jpg" alt="" width="106" height="72" title="" /></a></li>
            <li><a href="http://www.rhogueentertainment.com/images/2010 mm BIG/2010 big5.jpg" class="pirobox_gal1" title="5th Project Image"><img src="http://www.rhogueentertainment.com/images/2010 mm SM/2010 sm5.jpg" alt="" width="106" height="72" title="" /></a></li>
            <li><a href="http://www.rhogueentertainment.com/images/2010 mm BIG/2010 big6.jpg" class="pirobox_gal1" title="6th Project Image"><img src="http://www.rhogueentertainment.com/images/2010 mm SM/2010 sm6.jpg" alt="" width="106" height="72" title="" /></a></li>
            <li><a href="http://www.rhogueentertainment.com/images/2010 mm BIG/2010 big2.jpg" class="pirobox_gal1" title="2nd Project Image"><img src="http://www.rhogueentertainment.com/images/2010 mm SM/2010 sm2.jpg" alt="" width="106" height="72" title="" /></a></li>
              <li><a href="http://www.rhogueentertainment.com/images/2010 mm BIG/2010 big3.jpg" class="pirobox_gal1"  title="3rd Project Image"><img src="http://www.rhogueentertainment.com/images/2010 mm SM/2010 sm3.jpg" alt="" width="106" height="72" title="" /></a></li>
          </ul>
        </div>
      </div>
    CSS
    #gallery{
              width: 560px;
              float: left;
              margin: 0;
              overflow:hidden;
              width: 560px;
              height: 400px;
              line-height: 19px;
              float: left;
              font-size: 19px;
              margin: 0;
              overflow: visible;
    #gallery ul {
              list-style-type:none;
              width:100%;
    #gallery li {
              width:  106px;
              height: 73px;
              float:left;
              color: #ffffff;
              padding: 0;
              margin:0 20px 20px 0;
    Good luck.
    Rik

Maybe you are looking for

  • Dual display, multiple desktops

    Hello everyone. I've recently purchased a 2nd monitor for my pro, and came across the issue of having the 2nd montior change each time I change the desktop I'm currently using. After some searching online, I've found out that there is no workaround f

  • Computer not showing up in home share

    One of my computers doesn't show up in the home share so I can't transfer music.  What can I do to get it to show up?

  • How do I stop Finder, Firefox, Safari windows "auto-maximizing"

    I have searched the internet, the Apple websites, MacRumors, a bunch of other "Answers" type sites, trolled my settings and still can't find an answer to this or even explain it properly. On my MacBook Pro and Mac Mini I am having issues with the fin

  • How do you set auto retry on sending email?

    I have a problem that sometimes when sending an email from iphone4 that it won`t send if out of signal but doesn`t seem to then automatically send when signal strong enough. Is this normal and is there anyway settings can be changed to auto retry on

  • Meeting place 7.0 compatibility C20 and Movi.

    Hi, I need your help to know if the C20 and Movi devices is compatibility to works with meeting place 7.0. I've checked the cisco documentation and this devices has not been tested with this version. Anybody knows if it's can working? Regards