Removing extra character

Hello,
I have a textbox and a button in flash.  I send data to java server by entering data into the textbox.  Firsttime the number of characters i am receiving are correct, from the second time onwards there is an extra character.  i.e if i type 1 character it is showing 2.  Can someone tell me how do i remove it.
below is the code,
function msgGO() {
    if (inputMsg.htmlText != "") {
        mySocket.send(inputMsg.htmlText+"\n");
        inputMsg.htmlText = "";
pushMsg.onRelease = function() {
    msgGO();
Thanks.

Thanks for your reply.
I observerd that even if i directly send the data without entering into the textbox i am getting same result.
mySocket.send("1");
mySocket.send("3");
In java, for the first data it shows number of characters (strlen) as 1.  for the second data it is showing 2.
The character i am not able to know, there is a blankspace  towards the left of the character.
Thanks

Similar Messages

  • Removing extra spaces from a long document

    Hello
    I have seen a number of find/change and GREP formulas to do similar things. I have NO scripting or coding experience and have labored to understand GREP.
    So I am a little afraid to use it as I don't know what all the modifiers refer to (I do have a printout of some neat GREP cheatsheets like Mike Witherell's that I can absorb until I obtain a good reference )
    I need something I can copy and paste into either find/change or GREP dialog that will do the following in less than 12 steps (hopefully) without doing something catastrophic like removing all of my paragraph marks (which I almost did using someones GREP expression)
    No spaces before any comma, period, exclamation mark, question mark, colon, semicolon
    One space only after any of those
    One Space before any opening parenthesis and one space after the closing parenthesis
    No space after the opening parenthesis or before the closing parenthesis
    Remove any double or extra spaces ( en, em etc.)
    Remove any commas before parentheses
    Remove any spaces after a paragraph mark
    I think that's it
    I did find this one recently (Maybe Jongware?)
    [~m~>~f~|~S~s<~/~,~3~4%]{2
    Which from my dim understanding addresses em, en, flush and hair space ,  nonbreaking space ,figure space,third space--not sure of the rest. Really this is way over my head.
    I know this will be a piece of cake for you guys
    Thanks

A: Removing extra spaces from a long document

Peter is too modest, he's doing just great.
No space BEFORE-One Space after ---period,semicolon,colon, exclamation, question mark,CLOSING Parenth,Bracket,Brace, single & Dbl. quotation marks
Find (\s)([.,;:!\)\]\}~}~]])
Replace with $2
No space AFTER-One Space Before----OPENING bracket,brace,parenthesis,Dbl & single quotes
Find ([\[\{\(~{~[])(\s)
Replace with $1
These remove the space before/after but do not automatically add a space after/before.
In the first case, you could add a space right after the '$2' in the Replace With string, but it already may have a space, in which case you suddenly have two. One alternative is to optionally remove it with the Find string (add it as an optional match) and always add it with the Replace string, but remember that this string will only be found if there is a space preceding it. That way you'd only check the space after in cases where there was a bad space before.
So I propose you add another two find/changes to add the space, only when necessary.
One Space After: find
([.,;:!\)\]\}~}~]])(?!\s)
replace:
$0 [followed by one single space]
One Space Before: find
(?<!\s)([\[\{\(~{~[])
replace:
[one single space] $0
Color-coding with my WhatTheGrep might make it just a tad clearer what's going on in that jumble of codes:
(1 [ .,;:! \) \] \} ~} ~] ] 1) (?!! \s !)
and
(?<!<! \s <!) (1 [ \[ \{ \( ~{ ~[ ] 1)
(Orange is lookahead/lookbehind, blue is a regular escaped character, pink is an InDesign special character, green is normal grouping parentheses, and lavender is a character group.)

Peter is too modest, he's doing just great.
No space BEFORE-One Space after ---period,semicolon,colon, exclamation, question mark,CLOSING Parenth,Bracket,Brace, single & Dbl. quotation marks
Find (\s)([.,;:!\)\]\}~}~]])
Replace with $2
No space AFTER-One Space Before----OPENING bracket,brace,parenthesis,Dbl & single quotes
Find ([\[\{\(~{~[])(\s)
Replace with $1
These remove the space before/after but do not automatically add a space after/before.
In the first case, you could add a space right after the '$2' in the Replace With string, but it already may have a space, in which case you suddenly have two. One alternative is to optionally remove it with the Find string (add it as an optional match) and always add it with the Replace string, but remember that this string will only be found if there is a space preceding it. That way you'd only check the space after in cases where there was a bad space before.
So I propose you add another two find/changes to add the space, only when necessary.
One Space After: find
([.,;:!\)\]\}~}~]])(?!\s)
replace:
$0 [followed by one single space]
One Space Before: find
(?<!\s)([\[\{\(~{~[])
replace:
[one single space] $0
Color-coding with my WhatTheGrep might make it just a tad clearer what's going on in that jumble of codes:
(1 [ .,;:! \) \] \} ~} ~] ] 1) (?!! \s !)
and
(?<!<! \s <!) (1 [ \[ \{ \( ~{ ~[ ] 1)
(Orange is lookahead/lookbehind, blue is a regular escaped character, pink is an InDesign special character, green is normal grouping parentheses, and lavender is a character group.)

  • 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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Removing extra text after a certain point for a field

    Post Author: ralph.devlin
    CA Forum: Formula
    Hello,
    What we want to do is remove extra text, IE (PO12345.195) We would want to remove the .195 from the end of that data so that the groupings will group them correctly. How can I accomplish this. The defaul trim commands seem to only elimnate white space, I want to elimnate text up to a certain point. thanks
    Ralph

    Post Author: Charliy
    CA Forum: Formula
    You want to do an INSTR to locate the period, then a LEFT to only show the data before it.  Something like:
    IF INSTR({table.field},".") > 0 THEN LEFT({table.field},(INSTR({table.field},".") )-1) ELSE {table.field}
    I subtracted 1 because in your example above the period is in position 8 and you want the first 7 characters.

  • Remove extra space value of the field  in text element

    Dear All,
    Can any one please help me out to remove the blank spaces in the text elements of SF.
    we are printing Label in which i want print  quantity of material. and i am using MSEG-MENGE for quantity of maetrial.
    But the issues is when we are printing the label. We are getting spaces  in the Text elements fields &MSEG-MENGE&.
    i am also check menge field within mseg table. in which menge field define as QUAN data type with length 13.
    <
    MAT CODE:&t_MSEG-MATNR&
    DESC:&MAKTX&
    QTY:&t_MSEG-MENGE&          
    UOM:&t_MSEG-MEINS&
    >
    My Output in SF:
    MAT CODE:11000002
    DESC:Coarse Aggregate 10mm Sieve
    QTY:             960
    UOM:LBM
    MIGO.NO.:4900000025
    how to remove extra blank spaces in the text elements ( QTY:             960 )
    guide me.........

    Dear All,
    I am using  code block in SF before text element.
    In  The Text Element ...
    <
    MAT CODE:&t_MSEG-MATNR&
    DESC:&MAKTX&
    QTY:&t_MSEG-MENGE&
    UOM:&t_MSEG-MEINS&
    MIGO.NO.:&t_MSEG-MBLNR&
    PO.NO.:&t_MSEG-EBELN&
    LOCATION:&t_MSEG-WERK&&NAME1&
    >
    In programe Line ( code block )....
    <
    read table t_mseg index w_index.
    qty = t_mseg-menge.
    condense qty.
    SELECT SINGLE name1 FROM t001w INTO name1 WHERE werks = t_mseg-werks.
    SELECT SINGLE maktx FROM makt INTO maktx WHERE matnr = t_mseg-matnr.
    >
    My Output:
    MAT CODE:11000002
    DESC:Coarse Aggregate 10mm Sieve
    QTY:                                                      960
    UOM:LBM
    MIGO.NO.:4900000025
    Only problem in value of Quantity field .
    guide me.........

  • Grep for removing extra paragraph returns?

    Hey all you smart people out there. Can I use GREP to remove extra paragraph returns? I'm working on basically a directory, pages and pages of names, addresses, and phone numbers imported from a Word doc. Each line has a style applied,with the first line of each listing being a different style than the others, and a hard paragraph return at the end of each line. There is an extra paragraph return in between each listing. Once I get the styles applied, will GREP allow me to search for the first style in each listing and remove the extra paragraph return in front of it?
    Here's a screen shot. The listings at the top are already formatted, the bottom ones haven't been formatted yet. Basically, I import and apply the style that's most used, and then go in and change the gray bars, and the name/phone. So, I do have to go through the whole thing, but it would still be less clicks overall if I could format everything and then have GREP do the rest.
    Thanks!

    Thanks, John, I'll try that. There are a few more (larger) sections coming that will need cleaning up.
    I've been doing this project annually for a few years now, need to get better organized with InDe's automation features, which I know will make my life much easier.
    Sometimes I do some of the cleanup in Word, simple find/changes for double spaces and the like. Their styles are never my styles so I always strip out the Word styles when I place the text, rather than try to match them up on import. Often, the listings come in with a return instead of a tab, grrr. So, the name listing, when it's formatted in InDe, is the person's name/space/right-tab with leader dots/space/phone number (a lot like the White Pages). But in the Word doc, each item is a separate line, and sometimes I have to put everything in the right order so that when I get it into InDe at least all I have to do is delete a paragraph return and then apply a style to the line.
    I only do one of these a year, so it's not worth it to invest in expensive scripts or extensions. That said, I do need to take better advantage of the built-in features. I'll have to look on Lynda.com for tutorials--I'm sure there are some there.

  • Removing Extra Stuff from Scanned Page...

    Hi All,
    I have a scanned page saved as a JPEG file. The page contains handwritten stuff (like text or drawings in black or colored ink). How to remove extra stuff like page shrink marks or background of the paper from the scanned page so that only written or drawn things should be visible ? Usually we do that using package like PhotoShop. Any Idea to achieve that in Java ? (If possible with codes...)
    Thanks in Advance...
    JShishya

    Hmmm....
    If you have lots of free time, you will need to design and create the necessary algorithms... not
    easily achieved if you have no previous experience.
    The math/processing required is large and complex - you will need to identify per pixel errors and
    tolerance , based on the algorithm's output you would then have an include/exclude decision... :)
    Good luck....

  • How to remove extra spaces in a xml formatted string

    Hi,
    I am trying to remove extra spaces between the xml tags. For
    example, if a string is something like
    ' <header 1> <header 2> test </header 2> </header1>'
    I want to get rid of the spaces only between the closing tag of header 1 and opening tag of header 2 and closing tag of header 2 and opening tag of header 1, in short ,I want to remove the extra spaces between the tags if there are no other characters between them. I do not want the remove the spaces between closing tag header 2 and opening tag of header ,as there is occurence of other characters.
    I am aware that this can be done by looping through the string and using instr to identify the characters '<' and '>', but I would like to use it as a last resort only.
    Can anyone suggest me a better way of doing it in a single go by manipulating the data?
    Any help is really appreciated.
    Regards,
    Anil.

    You can use the replace function. If you only expect one extra space, then:
    scott@ORA92> select replace ('<header 1> <header 2> test </header 2> </header1>',
    2      '><', '><')
    3 from dual
    4 /
    REPLACE('<HEADER1><HEADER2>TEST</HEADER2></HEADER
    <header 1> <header 2> test </header 2> </header1>
    If you expect more extra spaces, then you will need to wrap another replace function around it for each space, for example the following will eliminate up to three spaces:
    scott@ORA92> select replace (replace (replace ('<header 1> <header 2> test </header 2> </header1>',
    2      '>     <', '><'), '>     <', '><'), '> <', '><')
    3 from dual
    4 /
    REPLACE(REPLACE(REPLACE('<HEADER1><HEADER2>TEST
    <header 1><header 2> test </header 2></header1>

  • How do I remove extra mail boxes

    I am trying to remove extra mail boxes from my iPad 1, with no success. Help please

    IF it is a mailbox that you added to the account - when you are in the email account in the window that shows all of the mailboxes for the account - tap on the edit button - then tap on the mailbox that you want to remove - a new window will pop up with the red delete button in it. Tap it to delete the mailbox.

  • How do I remove extra profiles from color mangement in Print Module?

    How do I remove extra profiles from color mangement in Print Module?

    If you're talking about the "short list" then click on other and then uncheck the ones that you don't want displayed. If you're talking about the long list, then you will have to browse to the folder containing the profiles and then delete them manually.

  • JTextPane-Extra character is adding to StyledDocument. How to overcome it ?

    Hi All,
    In my application, when I tried to increase the font size of the styled text every time an extra character is adding and its font size is not increasing as expected. Please try to run the below application as mentioned steps below :
    After running the application
    Step 1: Click on "Button1" and observe console. You will find list of all characters.
    Step 2: Click on "Button2" and observe console. Now you can see the RTF text's byte[] at console.
    Step 3: Click on "Button3" and observe console. You will find list of all characters along with their updated font size. (One extra character will be show in character's list)
    Try to do Step2 and Step3 repeatedly
    each time one extra character will be added to list and the new character's font size not be reducing.
    I have two problems here
    1. When I copy RTF byte[] from one DefaultStyledDocument to another one extra character is adding the new document object. How to avoid this extra character from the new document ?
    2. Why every time the last character's font size is not increasing ?
    import java.awt.BorderLayout;
    import java.awt.Container;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JTextPane;
    import javax.swing.text.AttributeSet;
    import javax.swing.text.BadLocationException;
    import javax.swing.text.DefaultStyledDocument;
    import javax.swing.text.Document;
    import javax.swing.text.Element;
    import javax.swing.text.SimpleAttributeSet;
    import javax.swing.text.Style;
    import javax.swing.text.StyleConstants;
    import javax.swing.text.StyleContext;
    import javax.swing.text.rtf.RTFEditorKit;
    public class CopyStyledTextDocument extends JFrame
        RTFEditorKit rtfKit = new RTFEditorKit();
        DefaultStyledDocument orgDoc = null;
         static final JTextPane pane = new JTextPane();
         static final JButton getStyledCharecters = new JButton();
         static final JButton saveOrgDoc = new JButton();
         static final JButton changeFont = new JButton();
        CopyStyledTextDocument()
            getStyledCharecters.setText("Button1");
            getStyledCharecters.setSize(50, 50);
            getStyledCharecters.addActionListener(
                      new ActionListener()
                           public void actionPerformed(ActionEvent e)
                                DefaultStyledDocument doc = (DefaultStyledDocument)pane.getStyledDocument();
                                String newChar = "";
                                int length = doc.getLength();
                                for(int i=0;i<length;i++)
                                     try
                                          newChar = doc.getText(i, 1);
                                          System.out.println("------- charPos : "+i+" char : "+newChar);
                                     catch(Exception ex)
                                          System.out.println("Error : "+ex);                                      
                                          ex.printStackTrace();
            saveOrgDoc.setText("Button2");
            saveOrgDoc.setSize(50, 50);
            saveOrgDoc.addActionListener(new ActionListener()
                           public void actionPerformed(ActionEvent e)
                                CopyStyledTextDocument.this.orgDoc = CopyStyledTextDocument.this.copyStyledDocument((DefaultStyledDocument)pane.getStyledDocument());
            changeFont.setText("Button3");
            changeFont.setSize(50, 50);
            changeFont.addActionListener(
                      new ActionListener()
                           public void actionPerformed(ActionEvent e)
                                Style newStyle = new StyleContext().addStyle(null, null);
                                DefaultStyledDocument newDoc = CopyStyledTextDocument.this.orgDoc;
                                int totalChars = newDoc.getLength();
                                for(int i=0;i<totalChars;i++)
                                     String newChar = "";
                                     Element charElement = newDoc.getCharacterElement(i);
                                     AttributeSet charArributeSet = charElement.getAttributes();
                                     try
                                          newChar = newDoc.getText(i, 1);
                                     catch(Exception ex)
                                          System.out.println("Error : "+ex);
                                          ex.printStackTrace();
                                     int fontSize = ((Integer)charArributeSet.getAttribute(StyleConstants.FontSize)).intValue();
                                     fontSize += 10;
                                     StyleConstants.setFontSize(newStyle, fontSize);
                                     try {
                                          newDoc.replace(i, 1, newChar, newStyle);
                                          System.out.println("------- charPos : "+i+" char : "+newChar+" fontSize : "+fontSize);
                                     }catch(Exception ex) {
                                          System.out.println("Error : "+ex);
                                          ex.printStackTrace();
                                     pane.setStyledDocument(newDoc);
         public DefaultStyledDocument copyStyledDocument(DefaultStyledDocument inputDoc)
             DefaultStyledDocument newdocument = null;
              try
                   ByteArrayOutputStream bOData = new ByteArrayOutputStream();
                   rtfKit.write(bOData, inputDoc, 0, inputDoc.getLength());
                   String styledText = new String(bOData.toByteArray());
                   System.out.println("------- RTF byte[] : "+styledText);
                   ByteArrayInputStream bIData = new ByteArrayInputStream(styledText.getBytes());
                   newdocument  = new DefaultStyledDocument();
                   rtfKit.read(bIData, newdocument, 0);
              }catch(BadLocationException ex)  
                   System.out.println("Error : "+ex);
                   ex.printStackTrace();
              catch(IOException ex)       
                   System.out.println("Error : "+ex);
                   ex.printStackTrace();
              return newdocument;
      public static void main(String args[]) throws BadLocationException
           CopyStyledTextDocument jf = new CopyStyledTextDocument();
           jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           Container cp = jf.getContentPane();
           Document doc = pane.getStyledDocument();
           SimpleAttributeSet set = new SimpleAttributeSet();
           StyleConstants.setFontSize(set, 12);
           doc.insertString(doc.getLength(), " SAMPLE \n", set);
           doc.insertString(doc.getLength(), " TEXT \n", set);
           doc.insertString(doc.getLength(), " OVER ", set);
           cp.add(getStyledCharecters, BorderLayout.WEST);
           cp.add(saveOrgDoc, BorderLayout.SOUTH);       
           cp.add(changeFont, BorderLayout.EAST);        
           cp.add(pane, BorderLayout.NORTH);
           jf.setSize(800, 700);
           jf.setVisible(true);
    }Due to urgency I placed little bit of info. in below link
    http://forums.sun.com/thread.jspa?threadID=5409367&tstart=45
    But here I am placing a sample application which represents the problem clearly.
    If you have any queries please feel free to ask.
    Thanks for you help
    Satya.

    Your feed has two episodes, and they both appear when subscribing. So far the Store hasn't picked up the newer episode.
    This episode has duplicated 'enclosure' tags - both containing the same media file URL: this shouldn't be a problem as iTunes should simply ignore the second one.
    When you add a new episode to a feed it usually takes 1-2 days before the Store picks up the change, though it appear immediately for subscribers. If in fact you didn't have the second episode in the feed when it was first submitted this would probably be the reason.
    It's just possible that something in the feed is upsetting the Store but not the iTunes application on subscribing (which doesn't involve the Store) - however apart from the duplicated enclosure tag there doesn't appear to be anything unusual. Your media filename for the second episode has a space in it, which isn't a good idea, but the feed is handling this correctly by substituting the code %20, so it's unlikely that this is throwing the Store. However it would be better to avoid spaces altogether - they aren't allowed in a URL (hence the need to substitute the code).
    I should give it a couple of days and see if the episode appears.

  • How do I remove extra white spaces in a string?

    How do I remove extra white spaces in a string?
    trim() removes before and after spaces.
    If I have a string "This is Test"
    I want to remove extra spaces between words and also I want to keep SINGLE space
    between words. So output should be "This is Test". Thanks.

    replaceAll dosen't support with my version. Actually this works..............!!!!!!!!! Thank you.
                        java.util.StringTokenizer st = new java.util.StringTokenizer(brn, " \t");
                        StringBuffer buf = new StringBuffer();
                        while (st.hasMoreTokens()) {
                             buf.append(" ").append(st.nextToken());
                        String brn1 = buf.toString().trim();

  • How to remove extra spaces from Data Matrix Label?

    Hi All,
    Kindly let me know how we can remove extra spaces from Data Matrix Label.
    Suppose we have this following code in SO10.
    ^FO1380,1879^COY,78^BY4^BXR,6,200^FH^FD[)>_1E06_1DF01001T_1D6JUN&v_huf&&v_hul&_1DV&v_supnum1&_1D16K&v_del&_1D6D&v_flddat1&095_1D2L&v_unload&_1D
    P&v_article&_1D4L&v_madein&_1D_1E_04^FS.
    Variable have there own value. and the desired result will be shown like the attachment.
    But in my code it splits into new line when CMIR value has 3 spaces.
    If CMIR value is 1S0 820 355 A . then it creats a new line.
    Kindly suggest me any possible solution.
    Thanks,
    Partha

    Hi Gaurav,
    In print preview we can't see any space or new line. But when it scanned by TSB (barcode scanner) it will generate a new line when there is 3 space CMIR value.
    So where should I write SHIFT CMIR LEFT DELETING LEADING space this code?
    Because there is no space coming at the time of debugging or print preview.
    And in SO10 the code written as
    ^FO1380,1879^BY4^BXR,6,200^FH^FD[)>
    Here CMIR value is 1SO 820 303 A
    and generated output is like this.
    And desired output should be like this.

  • Why can I not remove extra spaces from Mail when composing?

    I am using Mail Version 8.1 and I cannot find a way to remove extra spaces from between my lines while composing. Every Enter makes the cursor go down two lines and there is no way to type in the space in between. There seems to be now way to see the html or any tags that can be causing this, and I cannot seem to find any setting to change the line spacing either. Does anyone know where to find any of these options so I can simply make the text single space?

    Open a message-editing window. Under the Edit menu, deselect all the options in the Spelling and Substitutions sub-menus. Test.

  • Removing "Extra Cost" options

    I am in charge of Oracle DB Server-related jobs including installation.
    We use Oracle 9i Enterprise R2 edition, with no extra cost option (I just realize extra cost option after installation and reviewing documentation).
    The program has been installed using default option and the databases have been created with default option.
    Now, how to remove such extra cost option through Oracle Installation (Product Inventory), from which that I should select to uninstall.
    I try the following:
    - select all extra cost option through manually searching (expanding +) the folder, and uninstall the product
    - change database option (database configuration) by removing extra cost option such as data mining, OLAP, spatial etc
    - remove all user, tablespace and schema related to extra cost option
    Anyway, when I see "Database - Instance Configuration", I always see DB Version Oracle 9i blah blah blah Production with Oracle Spatial & Data Mining Option. Why so, and what should I do?
    Sincerely,
    Ervin L

    Welcome to the forums !
    For disabling Data Mining, see MOS Doc 297551.1 (How To Remove the Data Mining Option from the Database)
    For RAT, see these MOS Docs
    Is it possible to deinstall/remove a specific component from already installed Oracle Database Home using OUI? (Doc ID 888934.1)
    How to Check and Enable/Disable Oracle Binary Options (Doc ID 948061.1)
    HTH
    Srini

  • Maybe you are looking for

    • Open PO list

      Dear experts, how can i find out a list of open POs? that is, I'd like to know those PO with open quantity against which no delivery have been created. How to find out such a list? Thank you and points will be rewarded if helpful.

    • On a PDF form, Save acts as if Save-As

      Windows XP SP3 Adobe Reader 10.1.1.33 I have started to fill out my U.S. federal tax forms for this year, just the names and address and a few checkboxes.  These are savable PDF files that I downloaded and saved from the IRS Web site.  I am doing thi

    • Verification Workflow error

      Hi experts I have went through previous threads and tried activating the config in SWU3 Tcode automatically. It has activated all the nodes as a result. After this i triggered Verify workflow and execute the first option "Execute background step imme

    • Substring in Bex

      Hi Is creating substring of a characteristic value possible in BEx. I did check other posts but the answers weren't satisfactory. Please let me know the process to do the same. Apart from this, is it possible to identify the number of records in a cu

    • Video Streaming - How to stop buffering time?

      Hi I am trying to watch a tv show I missed on NBC, "age of love" but the replay stops every minute to download more video I think. How do I improve the performance so I can watch the show without the constant interruption? thanks in advance Mark S iB