How to find string range

Say i have a string array from aa0 to aa100. Now how do i write a condition to check that this string lies between aa0 to aa100. please help

This is the code what i have typed. Its working but when i enter a value which is less then 0 and greater than 99, it still works, where as it shouldnt. Please help
    public void focusLost(FocusEvent evt) {
                if(evt.getSource() == mytextfield) {
              System.out.println("Inside focuslost");
              String text = mytextfield.getText();
              if(text.startsWith("aa")) {
                   int value;
                   try {
                        value = Integer.parseInt(String.valueOf(text.charAt(text.length() - 1)));
                   }catch(NumberFormatException nfe) {JOptionPane.showMessageDialog(null,"textfield should be \n in the range of aa0 - aa99","Test",JOptionPane.ERROR_MESSAGE);return;}
                   if(value < 0 || value > 99) {
                        System.out.println("Inside if condition");
                        JOptionPane.showMessageDialog(null,"textfield should be \n in the range of aa0 - aa99","Test",JOptionPane.ERROR_MESSAGE);
                        mytextfield.transferFocus();
                        return;
              else {
                    JOptionPane.showMessageDialog(null,"Invalid entry","Test",JOptionPane.ERROR_MESSAGE);
                    return;
    }

Similar Messages

  • How to find the Ranges for a field ?

    Hello All,
               Can anyone tell me how to find the ranges for a field.
    <b>1</b>, i.e say I want the Ranges Structure for the field LIFNR.
        The ranges structure for this is "<b>RANGE_LIFNR</b>".
        This I used in my Program since I know it previously.
        But now I want the ranges structure for the field <b>VBELN (Delivery Document).</b>
        I  don't know what is it !!!!!
    <b>2</b>, Is there any procedure to know the ranges structure for a particular field ?
    Regards,
    Deepu.K

    Hi Deepu,
    Using 'Where used list' you can able to find out RANGES tables.
    For VEBLN range table is --> CRM_AC_ASSIGN_VBELN
    If you using a program defined as shown below.
    DATA: r_vbeln type ranges of vbeln.
    The above statement also creates ranges structure in Runtime.
    Procedure finding range table structures
    go to SE37 -> Enter domain or dataelement value
    Go to where used list --> search for 'Structures'
    After getting all structure  --> Click 'SEARCH' butoon in tool bar --> Search for 'RANGES' word
    You can get all ranges tables in the search window
    If helps plz reward points.
    Regards
    Bhupal Reddy

  • How to find partioning_type – range or interval?

    I have a table which is interval partitioned. It has several range partitions and several interval partitions. Is there any way to find which partitions are range and which are interval. I looked in user_part_tables, it does not give me all partitions of the table. User_tab_partitions shows me all partitions, but does not tell partitioning_type.

    Well, it is possible they used a pre-release version of 11g for the book.
    But certainly testing 11.1.0.6.0 and checking the 11g documentation there is no evidence of a column named PARTITIONING_TYPE in DBA_TAB_PARTITIONS.
    The first SQL output listed on page 292 could be, scientifically, labeled as doctored. Not because of the non-existent PARTITIOING_TYPE column (maybe), not because it doesn’t match the create table definition listed on page 291 (see the HIGH_VALUE for partition P2 … maybe that is just a mismatch between their SQL scripts run at different times) … but because their INTERVAL_SALES table seems to have 2 different partitions named P1. The next SQL output on the page has the same issues. If they took the first output and accidentally over-wrote P1 over P3 ... well, they had that kind of accident twice !).
    Another confusing issue is further down on page 294 where they talk about moving the transition point. They create a 1-DAY interval-partitioned table with a transition point of 01-JAN-2008. Then they add three rows for 15, 16 and 30 JAN-2008, which creates 3 new interval partitions. They characterized the 3 new partitions as "+adjacent to one another+" and then proceed to say "+Because you can merge any two adjacent interval partitions+ …".
    The "+because+" statement is true but those 3 partitions are not adjacent to each other … the first 2 are adjacent but all 3 can only be characterized as consecutive (based on their DBA_TAB_PARTITIONS.PARTITION_POSITION values). The partition generated for the 15-JAN row can be merged with the one for the 16-JAN row (as they proceed to demonstrate) … but the partition generated for the 16-JAN row cannot be merged with the 30-JAN one. For the partitions to be adjacent they have to be consecutive first and consistent with the interval definition … with their test case, they have to be based on adjacent day intervals.
    No matter who the author, one should always test everything.
    As I said I don’t know how to extract the transition point from the documented data dictionary. Maybe someone else knows, maybe there is a post-11.1.0.6.0 patch, maybe dbms_metadata.get_ddl got fixed as well.
    My own empiric observations on the sys.tabpartv$ content are no proof.

  • How to find string with trailing space

    Hi,
    I need to search a word instead of string from another string.
    I tried below code and expected that FIND will not search 'weeds' but it seems FIND ignores trailing spaces of string zstr and thus finds word 'weeds'.
    DATA: zstr type string value 'we ',
              lv_string type string value 'These are weeds',
              result_tab TYPE match_result_tab.
    FIND FIRST OCCURRENCE OF regex zstr IN lv_string
                          IGNORING CASE
                          RESULTS result_tab.
    Please consider that zstr is runtime variable with no fixed length.
    If anybody has the solution, reply back fast !
    Regards,
    Sourabh

    Hi,
    Hi,
      DATA STRING(30) VALUE 'This is a little sentence.'.
    WRITE: / 'Searched', 'SY-SUBRC', 'SY-FDPOS'.
    ULINE /1(26).
    SEARCH STRING FOR 'X'.
    WRITE: / 'X', SY-SUBRC UNDER 'SY-SUBRC',
                   SY-FDPOS UNDER 'SY-FDPOS'
    SEARCH STRING FOR 'itt '.
    WRITE: / 'itt   ', SY-SUBRC UNDER 'SY-SUBRC',
                       SY-FDPOS UNDER 'SY-FDPOS'
    SEARCH STRING FOR '.e .'.
    WRITE: / '.e .', SY-SUBRC UNDER 'SY-SUBRC',
    SY-FDPOS UNDER 'SY-FDPOS'.
    SEARCH STRING FOR '*e'.
    WRITE: / '*e ', SY-SUBRC UNDER 'SY-SUBRC',
    SY-FDPOS UNDER 'SY-FDPOS'.
    SEARCH STRING FOR 's*'.
    WRITE: / 's* ', SY-SUBRC UNDER 'SY-SUBRC',
    SY-FDPOS UNDER 'SY-FDPOS'.
    Hope it will solve your problem..
    Pls. reward if useful...

  • How to find string contain.

    Dear all,
    i want to find some char from a given string like below example
    vtext = PM-BGM12_AC :
    if vtext contain '_AC'  then i have to assinge btext = ' Air Conditioner'.
    if vtext = PM-BGM12_BPI  contain '_BPI',
    then i have to assign btext = ' Building & Permanent Improvement '
    i m consfuse what to user ca , co, cs, cp.
    *********point is assured *********

    hi,
    chk out this
    <b><b>CO</b></b> Contains Only:  True, if operand1 only contains characters from operand2. Upper/lower case and trailing blanks are taken into account for both operands. If operand2 is of type string and is initial, then the logical expression is false, unless operand1 is also of type string and is initial, in which case the logical expression is always true. If the result of the comparison is negative, sy-fdpos contains the offset of the first character in operand1, that is not contained in operand2. If the result of the comparison is positive, sy-fdpos contains the length of operand1.
    <b>CN</b> Contains Not Only; True if a logical expression with CO is false, that is, if operand1 contains not only characters from operand2. sy-fdpos is set in the same way as for CO. If the comparison is true, sy-fdpos contains the offset of the first character in operand1 that is not contained in operand2. If the comparison is false, sy-fdpos contains the length of operand1.
    CA Contains Any: True, if operand1 contains at least one character from operand2. Upper/lower case and trailing blanks are taken into account for both operands. If operand1 or operand2 is of type string and initial, the logical expression is always false. If result of the comparison is positive, sy-fdpos contains the offset of the first character in operand1 that is also contained in operand2. If the result of the comparison is negative, sy-fdpos contains the length of operand1.
    <b>NA</b> Contains Not Any: True if a logical expression with CA is false, that is if operand1 does not contain any characters from operand2. If the result of the comparison is negative, sy-fdpos contains the offset of the first character in operand1 that is also contained in operand2. If the result of the comparison is true, sy-fdpos contains the le of operand1.
    CS Contains String: True if the content of operand2 is contained in operand1. Upper/lower case is not taken into account, trailing blanks of the left operand are taken into account. If operand1 is of type string and initial, or of type c and contains only blank characters, the logical expression is false, unless operand2 is also of type string and initial, or of type c and only contains blank characters. In this case the logical expression is always true. If the result of the comparison is true, sy-fdpos contains the offset of operand2 in operand1. If the result of the comparison is negative, sy-fdpos contains the length of operand1.
    <b>NS</b> Contains No String: True, if a logical expression with CS is false, that is if operand1 does not contain the content of operand2. If the result of the comparison is negative, sy-fdpos contains the offset of operand2. If the comparison is true, sy-fdpos contains the length of operand1.
    <b>CP</b> Covers Pattern: True, if the content of operand1 fits the pattern in operand2. Wildcard characters can be used for forming the operand2 pattern, where "" represents any character string, and "+" represents any character. Upper/lower case is not taken into account. If the comparison is true, sy-fdpos contains the offset of operand2 in operand1, whereby leading wildcard characters "" in operand2 are ignored if operand2 also contains other characters. If the comparison is false, sy-fdpos contains the length of operand1. You can select characters in operand2 for a direct comparison by adding the escape symbol "#" before the required characters. For these characters, upper/lower case is taken into account, wildcard characters and the escape symbol itself do not receive special treatment, and trailing blanks in operands of type c are not cut off.
    <b>NP</b> No Pattern: True, if a logical expression with CP is false, that is, if operand1 does not fit the pattern operand2. If the comparison is false, sy-fdpos contains the offset of operand2 in operand1, whereby leading wildcard characters "*" in operand2 are ignored if operand2 also contains other characters. If the comparison is true, sy-fdpos contains the length of operand1.
    thanks
    jaideep
    *reaward points if useful..

  • How to find string length in pixels

    Hi,
    I have a string "lucida bright regular". How can I get size of text in pixels.
    Can java.awt.Font work.
    An example wil really help.
    Thanks
    with regards

    Not exactly.
    I am applying font on text at web server using java
    and sending the resulting html to client end where
    is is displayed.
    Client can not change the
    font of that text.
    In that case you don't know the capabilities of modern browsers...
    Just because you want something bad enough doesn't make it happen.
    This is NOT Oz, this is the real world (or what passes for it for lack of alternatives).

  • How to find String associated with some long value.

    My requirement is to know the String associated with the long value, for ex 23423423 is having some value like 'skljflsjf'. Can any body findout soln for the same.
    Thanks
    ~ Chethangowda.

    My requirement is to know the String associatedwith
    the long value, for ex 23423423 is having somevalue
    like 'skljflsjf'. Can any body findout soln forthe
    same.
    Hum... I'm not 100% sure, but it seems the answeris:
    dgjldkgjfkljg
    Please, don't thank me before you confirm thething.
    Regards.Oooohhhh! That explains it! I guess I must've missed
    the part where he said he wants it translated to
    trollish. How stupid of me.You're absolutely not to blame... to be honest, if I had not read the OP 3-4 times carefully, I would not have found the solution.

  • How do you find the range of a counter and what do you mean by time limit

    hi
    can any one please tell me how to find the range of a counter for an 6025e DAQ board
    thanks

    Use Adjacent counters.vi to read the counter size (24 bits for the PCI-6025E --> range = 0 to 2^24 -1).
    You can access it in :
    1)..\vi.lib\daq\ctr.llb\
    2) Function palette --> DAQ --> Counter --> Am9513 & 8253 Compatibility
    Please clarify your question about the time limit.

  • How to find the number of occurence of a string

    String str="The AR tech seeks experienced candidates in java,jsp. The candidates should have atleast 1 year of experience in the specified skills.";
    here i need to find the number of occurence of the string "experience".
    how to find it out?

    String str="The AR tech seeks experienced candidates in java,jsp. The candidates should have atleast 1 year of experience in the specified skills.";
    String findStr = "experience";
    int count = 0;
    int index = 0;
    while(index != -1) {
    index = str.indexOf(findStr, (count == 0 ? 0 : index + findStr.length()));
    if(index != -1) {
    count++;

  • How to find the number of occurance of a string in text field of Infopath form?

    Hi All,
    In Infopath text field, How to find the number of occurrence of a particular string in that field?
    Thanks in advance!

    You can check to see if it contains a string once by using the contains function, but there isn't a very clean way to do what you want. If you wanted to guess at the maximum number of occurrences, then you could:
    Box A has your initial. Set Box B to do a concat of string-before and string-after of Box A where it copies Box A minus the string we're looking for. Then we have Box C that does the same thing to Box B. Repeat as many times as you see necessary.
    Example:
    String: "1"
    Box A - "123451234512345"
    Box B - "23451234512345"
    Box C - "2345234512345"
    Box D - "234523452345"
    etc.
    We then have a field that has nested ifs looking backwards from Z -> A looking for a non-blank. Based on that, we return the number of occurrences. Again, this isn't clean, but it will work if you think there's a predefinable maximum.
    Andy Wessendorf SharePoint Developer II | Rackspace [email protected]

  • How to find next number range for project definition in tcode CJ20N

    Hai Experts,
          Please help me 'How to find next number range for project definition in tcode "CJ20N". I was trying in function module NUMBER_GET_NEXT. Is it right function module? If its right what input i need to give for this tcode and for the field project definition?
    Note: I searched in forum before posting, but couldn't find the solution.
    Thanks
    Regards,
    Prabu S.

    Hi,
    For project defination internal number is assigned by system.
    When you saves's project then system allocate one number to project defination, you can view it,
    SE11 >>> table  PROJ >> Click on contents >>> execute,
    here you will get your project defination & number is assigned to project defination.
    kapil

  • How do I find the range of a bunch of #'s using for loops?

    I have a program that gets 13 numbers from the user and I nned to find the range of them. How do I do this with for loops?

    This is what I have so far
    if (one > two && one > three && one > four && one > five && one > six && one > seven && one > eight && one > nine && one > ten && one > eleven && one > twelve && one > thirteen)
                   big = one;
              else if (two > one && two > three && two > four && two > five && two > six && two > seven && two > eight && two > nine && two > ten && two > eleven && two > twelve && two > thirteen)
                   big = two;
              else if (three > two && three > one && three > four && three > five && three > six && three > seven && three > eight && three > nine && three > ten && three > eleven && three > twelve && three > thirteen)
                   big = three;
              else if (four > two && four > three && four > one && four > five && four > six && four > seven && four > eight && four > nine && four > ten && four > eleven && four > twelve && four > thirteen)
                   big = four;
              else if (five > two && five > three && five > four && five > one && five > six && five > seven && five > eight && five > nine && five > ten && five > eleven && five > twelve && five > thirteen)
                   big = five;
              else if (six > two && six > three && six > four && six > five && six > one && six > seven && six > eight && six > nine && six > ten && six > eleven && six > twelve && six > thirteen)
                   big = six;
              else if (seven > two && seven > three && seven > four && seven > five && seven > six && seven > one && seven > eight && seven > nine && seven > ten && seven > eleven && seven > twelve && seven > thirteen)
                   big = seven;
              else if (eight > two && eight > three && eight > four && eight > five && eight > six && eight > seven && eight > one && eight > nine && eight > ten && eight > eleven && eight > twelve && eight > thirteen)
                   big = eight;
              else if (nine > two && nine > three && nine > four && nine > five && nine > six && nine > seven && nine > eight && nine > one && nine > ten && nine > eleven && nine > twelve && nine > thirteen)
                   big = nine;
              else if (ten > two && ten > three && ten > four && ten > five && ten > six && ten > seven && ten > eight && ten > nine && ten > one && ten > eleven && ten > twelve && ten > thirteen)
                   big = ten;
              else if (eleven > two && eleven > three && eleven > four && eleven > five && eleven > six && eleven > seven && eleven > eight && eleven > nine && eleven > ten && eleven > one && eleven > twelve && eleven > thirteen)
                   big = eleven;
              else if (twelve > two && twelve > three && twelve > four && twelve > five && twelve > six && twelve > seven && twelve > eight && twelve > nine && twelve > ten && twelve > eleven && twelve > one && twelve > thirteen)
                   big = twelve;
              else if (thirteen > two && thirteen > three && thirteen > four && thirteen > five && thirteen > six && thirteen > seven && thirteen > eight && thirteen > nine && thirteen > ten && thirteen > eleven && thirteen > twelve && thirteen > one)
                   big = thirteen;
              if (one < two && one < three && one < four && one < five && one < six && one < seven && one < eight && one < nine && one < ten && one < eleven && one < twelve && one < thirteen)
                   little = one;
              else if (two < one && two < three && two < four && two < five && two < six && two < seven && two < eight && two < nine && two < ten && two < eleven && two < twelve && two < thirteen)
                   little = two;
              else if (three < two && three < one && three < four && three < five && three < six && three < seven && three < eight && three < nine && three < ten && three < eleven && three < twelve && three < thirteen)
                   little = three;
              else if (four < two && four < three && four < one && four < five && four < six && four < seven && four < eight && four < nine && four < ten && four < eleven && four < twelve && four < thirteen)
                   little = four;
              else if (five < two && five < three && five < four && five < one && five < six && five < seven && five < eight && five < nine && five < ten && five < eleven && five < twelve && five < thirteen)
                   little = five;
              else if (six < two && six < three && six < four && six < five && six < one && six < seven && six < eight && six < nine && six < ten && six < eleven && six < twelve && six < thirteen)
                   little = six;
              else if (seven < two && seven < three && seven < four && seven < five && seven < six && seven < one && seven < eight && seven < nine && seven < ten && seven < eleven && seven < twelve && seven < thirteen)
                   little = seven;
              else if (eight < two && eight < three && eight < four && eight < five && eight < six && eight < seven && eight < one && eight < nine && eight < ten && eight < eleven && eight < twelve && eight < thirteen)
                   little = eight;
              else if (nine < two && nine < three && nine < four && nine < five && nine < six && nine < seven && nine < eight && nine < one && nine < ten && nine < eleven && nine < twelve && nine < thirteen)
                   little = nine;
              else if (ten < two && ten < three && ten < four && ten < five && ten < six && ten < seven && ten < eight && ten < nine && ten < one && ten < eleven && ten < twelve && ten < thirteen)
                   little = ten;
              else if (eleven < two && eleven < three && eleven < four && eleven < five && eleven < six && eleven < seven && eleven < eight && eleven < nine && eleven < ten && eleven < one && eleven < twelve && eleven < thirteen)
                   little = eleven;
              else if (twelve < two && twelve < three && twelve < four && twelve < five && twelve < six && twelve < seven && twelve < eight && twelve < nine && twelve < ten && twelve < eleven && twelve < one && twelve < thirteen)
                   little = twelve;
              else if (thirteen < two && thirteen < three && thirteen < four && thirteen < five && thirteen < six && thirteen < seven && thirteen < eight && thirteen < nine && thirteen < ten && thirteen < eleven && thirteen < twelve && thirteen < one)
                   little = thirteen;
    I'm trying to fix this so it's not so confusing with for loops

  • How to find out no of lines in  String

    Hi all,
    How to find no of lines in a multi lined String.
    For example.
    String str = "hjkhjkhjhjhkhlk\nfjdhfjhdjfhjdhfj\nfdhfjdhjfhdj\ndfjdkjffjdfjk\nfdffdh";
    Here there are 5 lines because there are "\n".
    I am not able to substring with "\n".
    Any idea please?

    javadocs StringTokenizer
    StringTokenizer(String str, String delim)
    Constructs a string tokenizer for the specified string.
    Method Summary
    int countTokens()

  • How to find out the Number range object for Incident number

    How to find out the Number range object for Incident number ?
    CCIHT_IAL-IALID
    regards,
    lavanya

    HI, an example.
    data: vl_num type i,
          vl_char(6) type c,
          vl_qty type INRI-QUANTITY,
          vl_rc type INRI-RETURNCODE.
    CALL FUNCTION 'NUMBER_GET_NEXT'
      EXPORTING
        NR_RANGE_NR                   = '01'
        OBJECT                        = 'ZRG0000001'
       QUANTITY                       = '1'
      SUBOBJECT                     = ' '
      TOYEAR                        = '0000'
      IGNORE_BUFFER                 = ' '
    IMPORTING
       NUMBER                        = vl_num
       QUANTITY                      = vl_qty
       RETURNCODE                    = vl_rc
    EXCEPTIONS
       INTERVAL_NOT_FOUND            = 1
       NUMBER_RANGE_NOT_INTERN       = 2
       OBJECT_NOT_FOUND              = 3
       QUANTITY_IS_0                 = 4
       QUANTITY_IS_NOT_1             = 5
       INTERVAL_OVERFLOW             = 6
       BUFFER_OVERFLOW               = 7
       OTHERS                        = 8
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    vl_char = vl_num.
    write vl_char.
    Regard

  • How to find out if there are repeated characters in a string

    hey guys
    well i kinda have a little problem figuring out how to find out
    if there are repeated characters in a string.
    if anyone can help, would appreciate it.
    thanks
    milos

    Try using the StringTokenizer class. if u already know which character to trace. this could do the job.
    eg. String str = "here and there its everywhere";
    StringTokenizer st = new StringTokenizer(str, "e");
    int rep = st.countTokens();

Maybe you are looking for

  • Posting an Excel file to a FTP Server

    Hi, I have a requirement, where I have to convert the contents of an internal table to an excel file, along with header details and put that file to a FTP Server. I am able to create an excel file in FTP server, using function module FTP_R3_TO_SERVER

  • Differences between Preview and Acrobat Pdf for some files

    Good morning, My name is Roberto and I am from Venice (Italy). I'm a new Mac user (I need to use windows for my work because the softwares are only made for win). The problem (I think it is a problem of SL): I upgraded my MBP17 and iMac24 to SL. Last

  • Seesion issue with VO

    Hi, I am getting session issue in my application if i open my application in firefox and same time if i open application in IE (second session) ,data is not reflecting IE (second session) instead of data is coming whatever the first session(firefox)

  • Central Administraion Internal server error 500 | event id 5586 sharepoint foundation unknown sql exception 2812 could not find stored procedure dbo.proc_gettimerlock

    Hi, We have two SharePoint 2010 SP2 servers with one SQL 2012 Backend. Recently we cannot open the central administration, getting 500 internal server error and multiple SQL errors in event viewer: event id 5586 sharepoint foundation unknown sql exce

  • How much does 5GB icloud hold?

    I keep getting alerts that my iCloud is almost at capacity.  5GB sounds like so much storage.  I can't believe that a normal person such as myself would even get close to using it all.  I have no documents, only 800 pictures and perhaps the same amou