String: Correct format +digits +hyphen

I have a number in the following format (stored as a String):
01-000001
I would like to be able to make sure that above String contains a hyphen in the third character position, the string contains 9 characters total (including hyphen) and that everything except the hyphen is a digit (of numeric value).
Thanks in advance.

I have a number in the following format (stored as a
String):
01-000001
I would like to be able to make sure that above String
contains a hyphen in the third character position, the
string contains 9 characters total (including hyphen)
and that everything except the hyphen is a digit (of
numeric value).
Thanks in advance.Untested, and not necessarily syntactically correct, but...
boolean valid = (str.length() == 9);
if (valid) {
  valid = (str.charAt(2) == '-');
if (valid) {
  String first2 = str.substring(0, 2);
  try {
    Integer.parseInt(first2);
    String last6 = str.substring(3, 6);
    Integer.parseInt(last6);
  catch (NumberFormatException e) {
    valid = false;
}

Similar Messages

  • Processing this item failed because of a PDF parser error. Input string was not in a correct format.

    Good Morning,
    We're having issues parsing several hundred PDF files located in two separate Record Center sites. All other PDF documents in the environment are being crawled and parsed without issue. I've verified the permissions for the Search service account, but that
    doesn't seem to be the issue. Searching for this particular error hasn't returned much, but I have ensured that the Search service account has been added to the necessary Local Security Policy objects and cleared the configuration cache. Any help would be
    greatly appreciated.
    Processing this item failed because of a PDF parser error. ( Error parsing document 'https://asdf.com/sites/HRRecords/asdf.pdf'. Input string was not in a correct format.; ; SearchID = 6642FEEF-6921-434E-B084-02809173D8A7 )

    This issue came back up for me as my results aren't displaying since this data is not part of the search index.
    Curious if anyone knows of a way to increase the parser server memory in SharePoint 2013 search?
    http://sharepoint/materials-ca/HPSActiveCDs/Votrevieprofessionnelleetvotrecarrireenregistrement.zip
    Processing this item failed because the parser server ran out of memory. ( Error parsing document 'http://sharepoint/materials-ca/HPSActiveCDs/Votrevieprofessionnelleetvotrecarrireenregistrement.zip'. Document failed to be processed. It probably crashed the
    server.; ; SearchID = 097AE4B0-9EB0-4AEC-AECE-AEFA631D4AA6 )
    http://sharepoint/materials-ca/HPSActiveCDs/Travaillerauseindunequipemultignrationnelle.zip
    Processing this item failed because of a IFilter parser error. ( Error parsing document 'http://sharepoint/materials-ca/HPSActiveCDs/Travaillerauseindunequipemultignrationnelle.zip'. Error loading IFilter for extension '.zip' (Error code is 0x80CB4204). The
    function encountered an unknown error.; ; SearchID = 4A0C99B1-CF44-4C8B-A6FF-E42309F97B72 )

  • Help with Oracle Connection- "Input string was not in a correct format"

    Hello, can some one, anyone please help me. I have a simple VS 2005 C# application that connects to oracle. I've set it up to take the username, password and tnsname as arguments. I am using Client 9i, version 9.2.0.401 of Oracle.DataAccess.dll, and .NET Framework 2.0.
    It works fine when I run it from VS 2005, I have also set up a test machine w/o VS 2005 and ran my install package and it runs fine. I sent it to one of my co-workers and when he tries it the OracleConnection obect fails with the error.
    "Input string was not in a correct format"
    strange in that it is not an ORA error, just the identifed text!?
    Here is the code:
    ## begin code
    OracleConnection dbc = new OracleConnection();
    string sConnectString = "User Id=" + username.ToString() + ";Password=" + password.ToString() + ";Data Source=" + tnsname.ToString();
    dbc.ConnectionString = sConnectString.ToString();
    MessageBox.Show("Attempting to Connect to Oracle");
    dbc.Open();
    MessageBox.Show("Connected to Oracle: " + dbc.ServerVersion);
    ## end code
    Pretty basic, what could be going on?
    Since this only happens with an installation, I put in the message boxes to verify exactly where it chokes. I get the first message box, then an error with the identified text. I've seen a number of posts regarding input string format problems, but not a one dealing with OracleConnection.Open(). I added all the ToString() calls just to make sure everything was a string but it did not change the end result.
    Anyone? Thanks In advance!
    Eric S.

    Hello,
    well, i got a message "...string not wellformed format...", too.
    If you have defined the parameters as string, you don't need the additonal "ToString()". Please ckeck your tnsnames -string. Try to debug this. I believe you have copy the format from the tnsnames.ora and there you have much brackets.
    For example, two code snippets:
    As datasource i use <Server>:<Port>/<Instance>
    try
    string FDsn ="User Id="+FDbUser+";Password="+FDbPwd;
    FDsn +=";Data Source=wth5:1521/Ora9.wth5";
    FConn = new OracleConnection(FDsn);
    FConn.Open();
    if (FConn.State == ConnectionState.Open )
         FConn.Close();
    catch (Exception ex)
         FStateMsg = "Connection to database failed. Check Configuration in parameter: ConnectionString. " + ex.Message;
    Above i connect to a Ora 9.2.0.1
    by using
    FDsn +=";Data Source=wth5:1522/XE";
    i connect to an OraExpress database on the same machine.
    My Oracle.dataAccess.dll ist the newest, 10.2.... and it runs under Framework 1.1.x and Framework 2.x
    I'll hope it will help you. Best regards!

  • Error:SOAP: response message contains an error XIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: Server was unable to read request. --- There is an error in XML document (1, 447). --- Input string was not in a correct format.

    Hi All,
        We have a scenario of FTP-->PI---> Webservice.  While triggering the data in the FTP, it is failing in the PI with the below error
    SOAP: response message contains an error XIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: Server was unable to read request. ---> There is an error in XML document (1, 447). ---> Input string was not in a correct format.
    Can you please help?

    Hi Raja- It seems to be a data quality issue.
    Check for the value @ 1447 position in the xml message that you are trying to send to web service..
    may be a date filed/decimal value which is not in expected format.

  • What is the correct format of filepath string on Mac os x?

    I am trying to retrieve a file from Mac os x by:
    File file=new File(filepath);
    My boot volume name is "myVol", and filepath is "/myVol/opt/ab.txt". However, when I provide this path, the file is not found. I just figured out that if I use "/opt/ab.txt" the correct file can be found!!
    Now, if I have a shared volume on my machine(I got it by menu "Go-->Connect to Server..."), whose name is "Mac Share", the filepath should be something "/Mac Share/test/123.txt". File file=new File("/Mac Share/test/123.txt") can not find the file. It looks like that it's trying to find 123.txt from /myVol/Mac Share/test directory, which doesn't exist. I even tried "//MacShare/test/123.txt", "Mac Share/test/123.txt", etc., and none of them worked!!
    If you know the correct format to specify the filepath on Mac OS x, please give me help!!!!
    Thanks in advance.

    I don't know the exact answer to your question, but you can probably figure it out on your own like:
    1) Create a File object that represents an existing file. Play around with the path until the file can be found.
    2) Now that you have a File object representing a valid, existing path, use MyFile.getAbsolutePath() to see what the full path string is. MyFile.getCanonicalPath() might provide some answers as well.
    Whatever getAbsolutePath() returns is the correct format for the file path string.

  • Put java.sql.Date in correct format

    I need to put java.sql.Date in correct format to query an Oracle database.
    Here is my code:
            SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yy");
            java.util.Date dateChosen = jXDatePicker1.getDate();
            String strDate = formatter.format(dateChosen);
            System.out.println("Date Chosen: " + strDate); // output is: 11-Feb-00
            java.util.Date parserDate = null;      
            try {
                parserDate = formatter.parse(strDate);
            } catch (ParseException re) {
                System.err.println("Exception caught: " + re.getMessage());
            // create java.sql.Date object
                java.sql.Date oraDate = new java.sql.Date(parserDate.getTime());
            System.out.println(oraDate);  // date is in this format: 2000-02-11
            System.out.println("formatted oraDate: " + formatter.format( oraDate ) ); // no good, stringIf I use formatter.format( oraDate ) I get the correct format (11-Feb-00) BUT it is no longer a sql Date, it is a String which can't be use.
    I have looked at the API and many other forum threads on this, any help would be greatly appreciated!

    In the class with the PreparedStatement, I pass the date like this:
    public class report extends javax.swing.JDialog {
         java.sql.Date newDate;
        public report(java.sql.Date passedOraDate, String passedtxtDate) {
            super();
            initComponents();
            setTitle("Report");
            setModal(true);
            newDate = passedOraDate;
            statusLabel.setText(passedtxtDate);
            System.out.println("passedtxtDate: " +passedtxtDate);       
            System.out.println("newDate: " +newDate);      
        }Here is the code that uses the actual PreparedStatement:
            try {
                // In my actual code I have all columns listed in query
                String query = "SELECT * FROM report WHERE repdate = ?";
                ps = conn.prepareStatement(query); // create a statement
                           ps.setDate(1, newDate); // set input parameter
                rs = ps.executeQuery();
                // extract data from the ResultSet
                ResultSetMetaData md = rs.getMetaData();
                int columns = md.getColumnCount();This is greatly edited to show relevant code!

  • Mac mini firewire vs Mac pro firewire, trouble with medium format digital back

    Hi
    I'm trying to use a Mac Mini to run a medium format digital back, I have problems with the connection between the digital back and Mac mini dropping out randomly meaning I have to unplug the firewire and restart the back, sometimes restart the software.
    Manufacturer says it is due to Mac mini firewire not supplying enough stable power to the back and to use a powered firewire repeater.
    I've tried that it hasn't really made much of a difference.
    Manufactuer now says the Mac Mini's are just not up to the job they are significantly diferent to the Mac pro range.
    Is this correct?
    So I can't use a small form factor mac mini to do a single task - tether to a camera and run camera software. Doesn't really seem that big an ask?
    thanks in advance.
    Nigel.

    you may think it's a single task, but that's on top of the underlying OS processes.  also, i'm assuming that your mini is only running a single hard drive, which means your software is competing against the OS for access to the write heads on your drive.  have you confirmed that your system memory isn't generating too many page outs?  if you're in activity monitor and you see that count increasing, you need more RAM.
    you could also try to install a second hard drive in your mini, and designate that drive as your write target for the camera software.
    is this for video, or stills?

  • Time From field is not getting displayed in correct format in Activities

    Hello Experts ,
    We are facing one problem in UI , when we search for Activities in Web UI . In the field "Time From" we are not getting the time in correct format , ie is instead of  getting time as say 13::38 we are getting time as 13::3 , but when we place cursor on it the field it shows correct format say 13::38.
    Can any one suggest how to display in correct format ?
    Regards
    Vinayak

    Hi,
    Its an SAP Product error.
    Please check note 1151821 ,if you facing the greyed button in time.Also the other note 1136402 needs to be applied for time display issue
    - Bobby

  • Error message is not in correct format in portal

    Hi,
    I am passing message into i_messages table in User Exit CATS0003 .
    Syntax Code:
    I_MESSAGES-MSGTY = 'E'.
    I_MESSAGES-MSGID = Message class name
    I_MESSAGES-MSGNO = Message no.
    I_MESSAGES-MSGV1 = Message Text.
    Append I_MESSAGES.
    But the error message populating from Exit is not being displayed in correct format in Portal.
    Message coming is like this:
    :/kgo/tm:032 Engagement code is not open during time entry.
    But the correct format should be:
    Engagement code is not open during time entry.
    Thanks in Advance.
    Madhu
    Edited by: Madhusmita Acharya on Jun 3, 2009 2:13 PM

    Hi Max,
    Yes message number of the message class is existing.
    In fact Message is coming in portal but extra message class name (/kgo/tm)and message no.(032) is coming like below
    I dont need these Message class & Message no. in message as below
    /kgo/tm:032 Engagement code is not open during time entry.
    I need message like below one.
    Engagement code is not open during time entry.

  • I have a MacBook Pro, I want to copy Itunes files to an SD card to play in my car, the SD Card doesn't appear in Itunes when I insert it, and I don't know how to convert the files to the correct format, can anyone help?

    I have a MacBook Pro, I want to copy Itunes files to an SD card to play in my car, the SD Card doesn't appear in Itunes when I insert it, and I don't know how to convert the files to the correct format, can anyone help?
    Thank you

    So it seems from reading the COMMAND manual that my first issue is that I used a 16GB SD card, and the manual says it will only recogize up to a 2GB SD card. I did use my MB Air's SD card slot and crated a folder and dragged the music files to it, then to the card. So I am going to get a 2GB card and try that next. Otherwise just stick with the iPOD connected. At least that is 8GB

  • I recently set up multiple accounts and when I was trying to figure out how to share files I messed up something in my documents. Everytime I open a doc from the ADMIN account, a box pops up that says "The file is not in the correct format" how to fix?

    I recently set up multiple accounts on my imac, When I was trying to figure out how to share the documents I must have done something wrong. When logged into the Admin account, I open up any document and I get a message box that says, "The Document could not be opened. The file isn't in the correct format. The file might be corrupted, truncated, or in an unexpected format." What did I do and how do I fix it?

    Without knowing what you did it is impossible to give advice on how to correct it.
    If these were files you copied over from some other system then just Re-Copy them replacing the ones that are corrupted.
    Other then that I suggest you Wipe the drive and start over with a clean reinstall of the OS and programs. Then if you want to share files to All Accounts place those files in a folder in the ROOT of the drive.

  • Can I show correctly formatted text areas when they are read only.

    Hi all,
    I have an application that allows users to enter large blocks of descriptive text in a TextArea field. This is a simple TextArea field with no spell check etc and is not an HTML editor.
    As part of this entry I use the normal 'return' key to enter line breaks / new paragraphs as you would expect.
    This works fine and the data is stored correctly. When I extract this text, via XML, into a BI Publisher PDF document, the text is correctly formatted with line breaks where they are expected.
    However, when I try and display this information on the screen, in read only mode, the line breaks are lost and all I see is a continuos block of text with no line breaks.
    I am displaying this as a TextArea in a read only form (basically the page is a copy of the entry/maintenance page with all the fields set to ReadOnly = Always) and I cannot get it to display correctly. As soon as I make the field ReadOnly = Never the text dispaly OK, but then the user can go and change it.
    How can I get this field to display correctly?
    Many thanks,
    Martin

    Hi Dimitri,
    Thanks for your reply.
    I tried changing the field source to:
    select replace(replace(MANUAL_STEP_TEXT,CHR(10),'
    '),CHR(13),'
    from tpa_rel_patches
    where patch_id = :P40_PATCH_ID
    and now I get:
    1.Take a backup of existing jdbc driver files In all the Tiers (Admin, External & Middle Tiers)
    cd $JAVA_TOP
    cp jdbc111.zip jdbc111.zip_4899697
    cp jdbc12.zip jdbc12.zip_4899697
    cp jdbc14.zip jdbc14.zip_4899697
    2.Apply the Oracle JDBC Drivers Patch using ADPATCH
    u4899697.drv
    Any ideas?
    Martin

  • I'm trying to create a Windows partition using Boot Camp. An error comes up telling me that I need to reformat my current partition(s) into one single partition. However, it's already formatted in the correct format, and is already a single partition.

    As made clear in the title:
    I'm trying to create a Windows partition using Boot Camp. An error comes up telling me that I need to reformat my current partition(s) into one single partition. However, it's already formatted in the correct format, and is already a single partition.
    My computer recently had a kernel panic, which apparently the corruption was in the system and needed to be erased and re-installed. I have a complete back-up using an external hard drive, and I am definitely not willing to do another one of those to reformat a partition that is already singular. I restarted the computer after ejecting my back-up, and after turning off time machine (thinking that boot camp was recognizing it as a secondary partition), however the error still occurs.
    Is there any way to get around this?

    diskutil list:
    /dev/disk0
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *750.2 GB   disk0
       1:                        EFI                         209.7 MB   disk0s1
       2:                  Apple_HFS Macintosh HD            749.3 GB   disk0s2
       3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
    /dev/disk1
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:                            Windows7               *2.9 GB     disk1
    diskutil cs list:
    No CoreStorage logical volume groups found
    mount:
    /dev/disk0s2 on / (hfs, local, journaled)
    devfs on /dev (devfs, local, nobrowse)
    map -hosts on /net (autofs, nosuid, automounted, nobrowse)
    map auto_home on /home (autofs, automounted, nobrowse)
    /dev/disk1 on /Volumes/Windows7 (udf, local, nodev, nosuid, read-only, noowners)
    From my very basic knowledge - it still looks as if there is only one partition (not including the windows 7 CD necessary to install the windows partition).

  • HT1338 I was backing up my MacBook with Time Machine on my new (correctly formatted) external hard drive.  It was going fine when my 2 yo knocked the hard drive.  Now TM said "failed" and the Mac refuses to recognize the external hard drive.  Help please?

    I was backing up my MacBook with Time Machine and using my new (correctly formatted) external hard drive.  All was going well when my 2 yo knocked the disk leading to a "failure" by time machine (Latest Backup:  Failed).  Now the MacBook will not even recognize the hard drive.  I have rebooted, tried all I can think of, but no acknowledgement of the drive.  The drive itself makes noise and vibrates as if working, but nothing from the Mac.  Please help or $100 down the drain...  Thank you.

    You may have already done these resets in the "tried all I can think of " portion of your post.....if not then here they are.....
    PRAM
    support.apple.com/kb/HT1379
    SMC
    support.apple.com/kb/HT3964
    .....hopefully that is all that is required.....

  • How to get correct format in file at Application server

    Hi,
    I am retrieving data MATNR,MAKTX,VENDOR,VENDOR NAME,PRODUCT HIERARCHY,QUANTITY(LABST),BUDAT.
    I am downloading the data into .xls file in both presentation and application server.
    In presentation I am getting correct format.
    Where as in application server I am not getting proper format.
    Quantity(MARD-LABST) is not coming proprely.(###6## instead of 36)
    How to get it in correct forma?I

    symbol means  Space
    Before transfer the data to File..
    condense MARD-LABST and then transfer it.
    I guess you are using charcter field LABST while transferring the data to file.
    Do not use quantity field directly,please move it to charcter field then condense it.
    Thanks
    Seshu

Maybe you are looking for

  • Can't install Adobe Reader using Firefox on Windows Server 2008 R2

    I am hoping someone can kindly help me out here. Using Firefox I went to http://get.adobe.com/reader/ and clicked the download button and received the Getplus add-on to Firefox. When Firefox restarts the getplus window opens but sits there and does n

  • Can a PDF of the data be attached with the email notification?

    Hello, When the user submits its data and you recieve the email notificaton, can a PDF of that data be attahced to the email. Thanks, Josh

  • Multiple event handlers registered for the same event and error when adding users to sec groups

    Project Server 2013 CU April (May) 2014 I've created and installed two event handlers (separate dll:s) and both are triggering on Project Published - initially, both are working fine. After an IISReset, trying to create a new security group (or add a

  • Send to OneNote

    When I do Send to OneNote I get multiple "pages" within a page. They are not really pages, more like images that can be resized and moved around. Example: I have a .txt file of java code. This .txt file is ONE continuous page. If I do print and selec

  • Missing camera calibration profiles (Nikon P7700)

    Until recently I've been able to apply a choice of camera calibration profiles (e.g. Camera Landscape, Camera Portrait etc.) in the Develop Module to images taken with my Nikon Coolpix P7700. However, these have now vanished, and I'm only left with t