Remove space character

I have a string. I want to replace the first occured space character after a valid character in comma character and the following space character I want to remove them.
ex: "a b c d e" => "a,b,c,d,e"
the string method replace(char, char) cannot do replace(' ', '')
can somebody help me?
thank you.

import java.util.regex.*;
class B  {
   public static void main(String[] args) {
     String INPUT = "a b c         d   e";
     String REGEX = "\\b\\s+\\b";
    Pattern p = Pattern.compile(REGEX);
    Matcher m = p.matcher(INPUT);
    StringBuffer sb = new StringBuffer();
    while(m.find()){
             String REPLACE = ",";
             m.appendReplacement(sb,REPLACE);
        m.appendTail(sb);
        System.out.println(sb.toString());
}

Similar Messages

  • Help in removing Space & Character

    Hi,
    I have a query where I need to remove the space & the character after this space in the query. Here is the query and the sample data. I am using Oracle 11g db
    select replace(my_col, chr(10), chr(32))test from tableA;
    ID       TEST
    1        121 1 
    2         69 1
    3        23678 0
    Desired Output
    ID       TEST
    1        121
    2         69
    3        23678
    Can someone give me an idea on how this solve this
    Thanks

    Unless this post is due to a glitch: DO NOT DOUBLE POST
    https://forums.oracle.com/thread/2577671

  • Array to spreadsheet string - remove space after delimiter

    Hi
    I created a Labview program to acquire a electrical signal and send it using TCP/IP.
    The image in attachment shows a piece of my code. The AQ subVI was created by me to accomplish the acquisition.
    However, the string that the "array to spreadsheet string" VI returns is something like this:
    -0.800781^ -1.030273^ -1.098633^ -0.942383^ -0.644531^ -0.209961^ 0.258789^ 0.712891^
    The VI is using the ^ character as a delimiter and it is converting commas to points as decimal separators.
    Now, what i would like to do is to remove the space character between the ^ character and the sample value, simply because that is what the receiver of the TCP/IP message wants.
    Can anybody help me?
    Thanks in advance
    Attachments:
    Array to spreadsheet.png ‏7 KB

    hi there
    remove the space between the ";" and "%" in your format specifier.
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"

  • Embedded html font removes spaces!

    I have a dynamic html textField which has embedded fonts.
    When I provide it with html, it is displaying formatted text
    (italic, bold, underline, etc) incorrectly. it removes a space
    directly in front of the formatted word.
    e.g. unformatted:
    hello world
    formatted:
    hello
    World
    I have tried placing the space inside and outside the format
    tag and it makes no difference. Switching off the embed makes the
    field display correctly, however my client wants embedded,
    anti-aliased text.
    This seems to occur quite randomly so that some formatted
    text in the same textfield does not display incorrectly, while some
    does!
    There are font symbols for all my formatted fonts in the
    library.
    Can anyone shed some light?

    Is the SPACE character included as well?
    smon_ed wrote:
    > Thanks for your reply.
    >
    > I have included all my required fonts seperately in the
    library. So all my
    > fonts are embedded as symbols and available to my
    dynamic textfields, which I
    > believe does the same thing as placing embedded
    texfields on frame 1 of the
    > movie, which I tried and which did not help.
    >
    > This seems to occur not just for ordinary formatting,
    but also for underlining
    > and font changing, which is specific to TextFormat
    object formatting. I donlt
    > see this effect when not using TextFormat object and
    when not using htmlText.
    >
    > I am greatly, massively, annoyingly stuck on this and
    it's a really really
    > really important thing! Pretty much crucial to the whole
    application!!
    >
    Manno Bult
    http://www.aloft.nl
    [email protected]

  • DW removes spaces surrounding updated library items

    I've filed a bug with Adobe on this issue, but I'm wondering
    if anyone else has received a fix for what I consider a
    showstopping bug. In a nutshell, whenever I update a library item,
    DW removes all spaces surrounding the updated library item, and
    will even remove spaces surrounding unrelated library items during
    the same operation.
    For example, let's say I have a simple library item that
    contains only the character "^". I insert that into a page to
    render like this: "| ^ |", using normal spaces in the page code to
    separate the three characters. If I then edit the library item to
    use the character "-" instead, all updated pages will lose the
    surrounding spaces: "|-|".
    I've developed hundreds of library items over the years, and
    can reproduce this over the last three versions of DW (8, MX 2004,
    MX), on multiple computers using new code or existing sites. If I
    edit a single library item, it corrupts hundreds of pages in a
    large site, and I have to use special searches to find and fix the
    error. I can't believe that noone else is affected by this problem,
    or isn't using library items to the extent that I do.
    I'd really like to see library item functionality repaired,
    and this is my last appeal before finding a replacement for DW, Are
    any DW developers monitoring this list?

    > bug is just as capable of affecting SSI
    I don't think so. At least, I have never seen it happen. Have
    you?
    > Library items are particularly aimed at professionals
    managing large
    > sites.
    I don't think so here, either. Why would one EVER choose a
    Library item
    over SSI? On a large site, you would upload hundreds if not
    thousands of
    files for each change with the former.
    > It is an opportunity to
    > create reusable code that can be managed and edited in
    one central
    > location, so
    > that changes to a single file can be replicated
    throughout the entire code
    > base.
    Precisely what SSI does, only better.
    > Yes, it may be more desirable to use a server side
    technology to control
    > these bits through the use of variables and includes,
    but I also build and
    > manage high performance web servers, and no dynamic
    language can even come
    > close to the speed of delivering static files,
    especially if you want to
    > withstand a slashdotting or other unusual burst of
    activity.
    This is true - since Library items are design-time tools, you
    take the
    bandwidth hit on the upload side of things rather than on the
    fetch side of
    things.
    > I'm hoping that someone at Adobe is monitoring this list
    They do not. If you need to communicate with them, you must
    contact them
    directly. But you have been told that Adobe is aware of the
    problem at
    least twice - is that not enough?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "jorey" <[email protected]> wrote in message
    news:[email protected]...
    > The examples I used are overly simplified to more
    clearly demonstrate the
    > problem. Using a server-side technology is not relevant
    to this issue.
    > This
    > bug is just as capable of affecting SSI, PHP, ASP, or
    any other code
    > edited and
    > managed with Dreamweaver.
    >
    > Library items are particularly aimed at professionals
    managing large
    > sites.
    > Who else would even be interested in such a feature? It
    is an opportunity
    > to
    > create reusable code that can be managed and edited in
    one central
    > location, so
    > that changes to a single file can be replicated
    throughout the entire code
    > base. To suggest that it is necessary to create slightly
    different
    > versions of
    > code snippets to suit the individual needs of each
    generated page utterly
    > defeats the purpose of library items.
    >
    > As for the uses of library items, sure, I'll use it to
    maintain large
    > blocks
    > of code, but it's also useful for little things that
    change on a regular
    > basis,
    > such as names of people in specific roles, addresses,
    phone numbers, email
    > addresses, URLs, dates and other things that might
    appear hundreds of
    > times
    > throughout a site in a variety of contexts. This bug has
    serious
    > repercussions,
    > because it is not limited to the item being updated. You
    could update a
    > large
    > block of code and have unpredictable changes occur
    elsewhere. This is
    > unacceptable, and may not be limited to library items,
    but may also affect
    > templates or any other site management function that
    relies on the same
    > routines.
    >
    > Yes, it may be more desirable to use a server side
    technology to control
    > these bits through the use of variables and includes,
    but I also build and
    > manage high performance web servers, and no dynamic
    language can even come
    > close to the speed of delivering static files,
    especially if you want to
    > withstand a slashdotting or other unusual burst of
    activity.
    >
    > But as I mentioned, the type of code or use of the
    library item is
    > irrelevant.
    > Dreamweaver as a programming editor has a serious bug.
    It's broken, and
    > needs
    > to be fixed. I'm hoping that someone at Adobe is
    monitoring this list and
    > will
    > understand that this is a problem that affects advanced
    users and whole
    > teams
    > who have made extensive and productive use of this
    feature before it was
    > broken.
    >

  • Sync Outlook 2003 / Nokia 6120 - space character i...

    Hi guys - I store my contact mobile phone #s in international format (ie +61 4xx xxxxxx) so they are accessable from overseas when I travel without having to edit.  Outlook 2003 seems to put a space character by default after the country code, so these appear as +61 4xxxxxxxx in Outlook.  When I sync my Nokia 6120 to Outlook this space then gets transferred across to the phone as the # for the contact.  When I receive anything from the contact (phone call, SMS etc), the number I have saved for them does not exactly match the number that comes through (either because of the extra space, or because it will come through in Australian format ie 04xx xxxxxx) and the contact does not get recognised by the phone, and simply appears as the #, not the contact name.  If I send an SMS first & this is replied to, it comes back correctly identified, but new messages etc from contacts are not identified.
    Is there any way to remove the space that Outlook seems to put after the country code by default?  And is there any way for the phone to recognise +61 4xxxxxxxx and +614xxxxxxxx and 04xxxxxxxx all as the same number for the same contact?

    maybe it can be accomplished using a macro or modifying this one
    http://www.tandasoft.com/software/outlook-nokia-pc-sync-fix/

  • Remove space in record

    HI all
    While executing DTP i am getting an error.INVALID CHARACTER.Its because of the space at the end of below mentioned records and also a space between * and (.
    '7.4*(9.92.53)
    '7.8*(204.25.1)
    I can go and correct in PSA.But for every load i need to do that.
    Is there any other alternative other than manually editing the record in PSA.
    PLease let me know,
    Thanks,
    Harika.

    See whether this blog helps.
    Invalid characters in SAP BW 3.x: Myths and Reality. Part 2.
    Also check below link.
    white space character issue in PSA
    Rama,
    If the problem with extra white space character add ALT 255 in RSKC character List and then load, you problem will be resolved.
    Regards,
    Hi
    The problem was resolved.
    I had added ALT+255 in RSKC, it works.
    Edited by: Mr. V on Oct 17, 2011 11:20 PM

  • How to remove space after paragrph in pages on ipad

    Can't figure out how to remove space after each paragraph in Pages for Ipad

    Settings > General > International > Region Format
    Set it to your country to format numbers and dates in the way your country does.

  • How to remove space below text?

    In the screenshot below, how to remove space below text? I simply added a text box using the type tool and I get that extra space bellow the letter "B" that I don't need. I want to remove that space to center the letter within the octogon.
    Thanks!

    You might consider giving the letter a negative baseline shift and aligning it to centre.
    That way you can adjust it so that its anchor point coincides with the centre of the hexagon.
    Like this:
    Another thing: You may find it easier working with type if you hide bounding boxes.

  • How do I remove space after paragraph?

    Does Robohelp have the "Remove Space after paragraph" button for reducing the space between lines, like the one in Word?

    In HTML the space after is controlled by the style in your CSS file. You need to edit the style in the Style Editor.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • How do I remove spaces or special characters within a cell for large amounts of data

    Is there any shortcut to remove spaces between words and numbers within a cell?
    Example:
    Current: .5 lt PET (6)
    Need: .5ltPET(6)
    Is there any shortcut to remove special characters between numbers within a cell?
    Example:
    Current: 0--000--000--0
    Need: 00000000

    Thanks Wayne.
    I have been away from using Numbers or Excel for 4-5 years so it is slowly coming back to me. I am get that I need to use the SUBSTITUTE function however I am having trouble with getting it to work.
    My Data
    ST PAULI 12/12 NR
    $27.16
    12oz NR(12)
    0--80660--95937--5
    ST PAULI 4/6/12 NR
    $28.76
    12oz NR(6)
    0--80660--95935--1
    ST PAULI DK 12/12 NR
    $0.00
    12oz NR(12)
    0--000--000--0
    ST PAULI DK 4/6/12 NR
    $28.76
    12oz NR(6)
    0--80660--95945--0
    ST PAULI N/A 4/6/12 NR
    $20.66
    12oz NR(6)
    0--80660--95955--9
    CAYMAN JACK 4/6/12 NR
    $29.12
    12oz NR(6)
    8--15829--01006--8
    CAYMAN JACK 8OZ/12PK CAN
    $23.18
    8oz CAN(12)
    8--15829--01061--7
    TGIF LIIT 10OZ FROZEN POUCH
    $35.80
    10oz POUCH(24)
    8--15829--01043--3
    TGIF MARGARITA 10OZ FROZEN POUCH
    $35.80
    10oz POUCH(24)
    8--15829--01047--1
    TGIF PINA COLADA 10OZ FROZEN POUCH
    $35.80
    10oz POUCH(24)
    8--15829--01045--7
    TGIF STRAWBERRY 10OZ FROZEN POUCH
    $35.80
    10oz POUCH(24)
    8--15829--01042--6
    BALLAST PT BIG EYE IPA 1/2 BBL
    $190.00
    KEG 1984oz (1/2 KEG)
    0--000--000--0
    BALLAST PT BIG EYE IPA 1/6 BBL
    $73.00
    KEG 660.1oz (1/6 KEG)
    0--000--000--0
    BALLAST PT BIG EYE IPA 4/6/12 CAN
    $33.00
    12oz CAN(6)
    6--72438--00052--7
    There are many more but this is enough to show you. I need to remove all spaces from the First and Third Columns. I need to remove all (--) from the fourth. Where do I put in the substitute function and what is source sting, existing-string, new-string, and occurrence.
    Thank You for your help.

  • Optional Vertical Space Character

    Paragraphs can have a "space before" and "space after" attribute, as you probably know. The nice thing about this is that if the paragraph is at the top of the page, the space before disappears.
    I would like to have a vertical space character that does the same. You insert it into a line by itself (Type>Special Characters>Vertical Spacer). It makes a vertical gap based on the leading you give it.
    BUT! if it appears as the top line of a text frame, it will disappear.
    Why is this good? Because it saves having to create a lot of paragraph styles to deal with each situation. For instance, currnetly, I may need the following styles:
    Block Quote Standalone [space before and space after]
    Block Quote beginning [space before no space after]
    Block Quote Middle [no space before no space after]
    Block Quote End [no space before space after]
    Block Quote Standalone Indented
    Block Quote beginning Indented
    Block Quote Middle Indented
    Block Quote End Indented
    That's 8 styles all for the different combinations of block quotes. If I had a "vertical space" character, I would need only two styles:
    Block Quote; and
    Block Quote Indented.
    Much easier to manage! The variations could be simply managed by inserting a vertical spacer as needed. Really useful idea, and similar to the way dedicated typesetting systems used to work several decades ago.
    Thanks,
    Ariel

    Perhaps. Not sure I understand. Could you elaborate?
    But let me explain. Here's an example. A regular long block quote will need 3 styles, depending on whether there needs to be a line space before or after the paragraph:
         BlockQuoteBeginning BlockQuoteBeginning BlockQuoteBeginning
    BlockQuoteBeginning BlockQuoteBeginning BlockQuoteBeginning
    BlockQuoteBeginning BlockQuoteBeginning BlockQuoteBeginning
    BlockQuoteBeginning BlockQuoteBeginning BlockQuoteBeginning
         BlockQuoteMiddle BlockQuoteMiddle BlockQuoteMiddle BlockQuoteMiddle
    BlockQuoteMiddle BlockQuoteMiddle BlockQuoteMiddleBlockQuoteMiddle
    BlockQuoteMiddleBlockQuoteMiddleBlockQuoteMiddleBlockQuoteMiddle
        BlockQuoteEnd BlockQuoteEnd BlockQuoteEnd BlockQuoteEnd
    BlockQuoteEnd BlockQuoteEnd BlockQuoteEnd BlockQuoteEnd
    BlockQuoteEnd BlockQuoteEnd BlockQuoteEnd BlockQuoteEnd
    And then you need a separate style for a standalone block quote, that needs a line space both above and below. So that's 4 common styles.
    Then, occassionally, each of these for will sometimes not need indentation. So that's another four styles.
    Also, if the book requires block quotes in footnotes (a bad idea, IMHO, but the choice is not up to me), that's another 8 styles for the same reason.
    The forced line break that you mention, if I've understood correctly, wouldn't work with justified paragraphs, since it will force the line before the forced break to be fully justified?
    Ariel

  • How do I remove spaces and special characters from the file name during rendering?

    I understand that I can set LR_renamingTokensOn to true, but I would like to replace all spaces in the file name with an underscore and remove characters not in the range A-Z and 0-9. What's the easiest way to achieve this?

    local photo = catalog:getTargetPhoto()
    local sesn = LrExportSession {
        photosToExport = { photo },
        exportSettings = {
            -- ... (determine from export preset) - whatev you want, just be sure you set export directory: LR_export_destinationPathPrefix
            LR_tokens = "{{custom_token}}",
            LR_tokenCustomString = LrPathUtils.removeExtension( photo:getFormattedMetadata( 'fileName' ) ):gsub( "[ %c]", "" ) -- remove spaces and control characters
    sesn:doExportOnNewTask()

  • How to remove a character in a file??

    I'm not getting how to remove a character from a file.Could anyone post a method to do this?Any help would be appreciable.

    Ohhh... and one more thing... unless you're really unlucky, a few "extranious trailing nulls" won't make a jot of difference to the size of the file on disk, each each file "fills" whole blocks anyway, which is 1K (I think) on both fister and *nix... unless of course we're talking "lots" of trailing-nulls, or lots-and-lots of files.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Find feature looses focus while typing a phrase, after typing the first space character.

    The find feature now looses focus while I am entering a phrase. After entering the first word of a phrase and the space character, the find box will reposition itself to a possible result on the web page on EVERY CHARACTER and I have to reposition the cursor BACK to the find box to enter every subsequent character in the phrase I am searching for. Is there a way I can turn this useless (for me) *feature* off?
    I used to be able to key the phrase I was looking for, and the box would turn red as I typed if the phrase did not exist. I would really appreciate being able to do this again. It now seems that Firefox 'jumps the gun' to find the phrase before I have completed typing it in.
    Thanks.

    *If you have many extensions then first enable half of the extensions to test which half has the problem.
    *Continue to divide the bad half that still has the issue until you find which one is causing it.

Maybe you are looking for

  • Keyboard problem on solaris express de installation

    Hello i m having problem to install solaris express developper edition on my pc, as when the installation start, it doesnt take anything i type from the keyboard. It s solaris express release 5.11 version snv_57. My keyboard is standard ps2 keyboard.

  • UPLOAD OF EMPLOYEE BP FROM CRM TO ECC

    Hi all, Is it possible to upload Employee Business Partners from CRM to ECC system. as per client business process we create Employee Business Partners in CRM system and they need to upload in to ECC system. I have worked on downloading of Employees

  • Trusted Reconciliation Status mapping does not work - 11g Release2

    Hi all, On my process for trusted reconciliation I have mapped my status attribute to Oim 'Status' attribute. It is as follow: UserStatus -> Status On my custom scheduled task I transform the status data get form HR (my trusted system) with the value

  • SBO 2007 and 596

    Should 596 be compatible with SBO 2007? My guess is it would be safer to get WebTools 2007 but if someone has 596 now and SBO 2005 and they want to upgrade to SBO 2007 are they required to upgrade to Web Tools 2007 as well? Thanks,   Steve

  • Can I make a speed displacement map?

    Is it possible for me to for example play the very left of my clip at 10% of the original clip's speed and the right at 200% with a smooth gradient of speed change inbetween (10% ~~~~ 200%)? I do not want to do the time displacement effect - which ju