Check string for alpha numeric

is there a direct way to check whether the string is alpha numeric?

private boolean isAlphaNumeric(String str){
          boolean blnNumeric = false;
          boolean blnAlpha = false;
          char chr[] = null;
          if(str != null)
               chr = str.toCharArray();
          for(int i=0; i<chr.length; i++){
               if(chr[i] >= '0' && chr[i] <= '9'){
                    blnNumeric = true;
                    break;
          for(int i=0; i<chr.length; i++){
               if((chr[i] >= 'A' && chr[i] <= 'Z') || (chr[i] >= 'a' && chr[i] <= 'z')){
                    blnAlpha = true;
                    break;
          return (blnNumeric && blnAlpha);
Hope this would solve your problem

Similar Messages

  • Check numbers in alpha numeric string

    Hi All
    Is there any direct command or function module which will find numbers in alpha numeric string or it will check that the string contains only numbers ?
    Regards
    Yogesh

    hi,
    data: fvalue(4) type c,
          nvalue(4) type n.
    fvalue = 'ABC1'.
    nvalue = fvalue.
    if fvalue cn nvalue .                                      
    message i000(zz) with 'fvalue contains not Only numbers'.  
    else.                                                      
    message i000(zz) with 'fvalue containsOnly numbers'.       
    endif.                                                     
    Regards,
    Sailaja.

  • Check string for two special characters back to back

    Hey all so I need to check if a string has 2 backslashes back to back ("\\"). So the string "\\computername\c$\file" would match but the string "C:\file\path" would not. I've tried contains, match, and like. I've tried the code
    below which does work but gives me a false positive when I have a string like this "\computername\file\path".
    $com = "\\computername\C$"
    if($com -match "\\"){
    Write-Host true
    }else{
    Write-Host false
    Thanks for any help!

    In Regex ^ matches the starting position of a string. \ is a special character in Regex so you need to escape it with another \, so since you want double backslash \\, you need to escape twice \\\\, so ultimately ^\\\\ reads, at the start of the string
     find \\
    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.
    Don't Retire Technet

  • Regex: check string for even number of a symbol

    Hi,
    for example "ass'asd'asd" is valid, but "asd'asd'asd'asd" is not, for symbol " ' ". I have tried every combination of \w, [...],',+ and nothing...
    Ideas?

    what is doing the %2 here, prome' ?If there are an even number of char symbol in String s, then s.length() - s.replace(""+symbol, "").length() will also be even. So that number mod 2 will equal zero (and return true).

  • How to error check string for LONG list of strings

    Hi All,
    Let's say I want to compare a string variable with a long list of strings to see if it matches anything in that list. Is there some built-in function that will make this easy. Or should I do it the old fashioned way and load a string array with the list and then for loop through the array comparing each element?
    Cheers,
    ScKaSx

    ScKaSx wrote:
    I'm alittle weak at using interfaces. If the string I am trying to compare is (String grade), then how do I define my List to be ("A+", "A", "A-", "B+", "B", "B-", "C+", "C", .....). This is as far as I've got:
    String grade = 'some letter to be compared'
    String [] GradeList = new String [] {"A+", "A", "A-", "B+", "B", "B-", "C+", "C", .....};Maybe I could summarize what I meant using your example:
    Set<String> PossibleGrades = new HashSet();
    PossibleGrades.add("A+");
    PossibleGrades.add("C");
    String grade = "some letter to be compared";
    if(PossibleGrades.contains(grade) )
       // do something...
    }

  • Subtotals in ALV report for ALPHA-NUMERIC field

    Hi Experts,
    I have problem while subtotalling values in ALV report.
    I have 8 fields in my fieldcatalog. Now, I have to do the subtotal based on 3rd field having name 'ABC'. This field is having type CHAR & having lenght 3.
    Now I wanted to do subtotalling for field 7 & 8 as 'NETWR' & 'MENGE' based on 3rd field.
    How we can do the subtotal?

    Hi,
    Refer this code
    *&      Form  sub_display_data
          text
    FORM sub_display_data .
    *--To sort the output through material number
      DATA : lwa_sort TYPE slis_sortinfo_alv.
      DATA : lit_sort TYPE slis_t_sortinfo_alv.
    *--Pass the values to the table
      lwa_sort-fieldname = 'PERNR'.             "Field name in o/p inttable
      lwa_sort-tabname   = 'it_final2'.         "Output Internal table
      lwa_sort-spos      = '1'.                 "Sort  sequence
      lwa_sort-up        = 'X'.                 "Sort in ascending order
      lwa_sort-down      = ' '.                 "Sort in descending order
      lwa_sort-subtot    = 'X'.                 "Subtotal
      APPEND lwa_sort TO lit_sort.
    *--Pass the values to the table
      lwa_sort-fieldname = 'WORKDATE'.          "Field name in o/p inttable
      lwa_sort-tabname   = 'it_final2'.         "Output Internal table
      lwa_sort-spos      = '2'.                 "Sort  sequence
      lwa_sort-up        = 'X'.                 "Sort in ascending order
      lwa_sort-down      = ' '.                 "Sort in descending order
      lwa_sort-subtot    = ' '.                 "Subtotal
      APPEND lwa_sort TO lit_sort.
    *--Pass the values to the table
      lwa_sort-fieldname = 'WEKLY'.             "Field name in o/p inttable
      lwa_sort-tabname   = 'it_final2'.         "Output Internal table
      lwa_sort-spos      = '3'.                 "Sort  sequence
      lwa_sort-up        = 'X'.                 "Sort in ascending order
      lwa_sort-down      = ' '.                 "Sort in descending order
      lwa_sort-subtot    = ' '.                 "Subtotal
      APPEND lwa_sort TO lit_sort.
      wa_layout-colwidth_optimize = 'X'.
      IF NOT it_final2[] IS INITIAL.
    *--Call the function module to display the ALV report
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            is_layout          = wa_layout
            i_callback_program = v_repid
            it_fieldcat        = it_fieldcat1[]
            i_default          = c_chk
            i_save             = c_save
            it_sort            = lit_sort
          TABLES
            t_outtab           = it_final2
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ELSE.
    *--Message No data found
        MESSAGE i888 WITH text-017.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " sub_display_data
    Regards,
    Prashant

  • How to generate password alpha numeric value

    dear friends,
    i have written a simple pl/sql to generate a password.
    declare
    cursor c1 is select * from passwd;
    begin
    for I in c1
    loop
    if I.pfno < 3000 then
    update passwd set pwd=I.pfno where i.pfno=pfno;
    ELSe
    update passwd set pwd=lpad(round(I.pfno/20520),4,'0') where i.pfno=pfno;
    commit;
    end if;
    end loop;
    end;
    In this the pfno is 8 digit alpha numeric. I get password generated when it is only numeric but how could i get if pfno is like 04MAS155.
    Kindly help as i have to generate the same as early as possible. I have already been given with procedure to generate random password by our guys but still as i had already generated password to some employees in my concern based on querries like above i request your help to generate for alpha numeric 8 digit number.

    -- get a random string
        FUNCTION string (opt char, len NUMBER)
              /* "opt" specifies that the returned string may contain:
                 'u','U'  :  upper case alpha characters only
                 'l','L'  :  lower case alpha characters only
                 'a','A'  :  alpha characters only (mixed case)
                 'x','X'  :  any alpha-numeric characters (upper)
                 'p','P'  :  any printable characters
            RETURN VARCHAR2;  -- string of <len> characters (max 60)
        PRAGMA restrict_references (string, WNDS);

  • Alpha Numeric - GL account numbering

    Hi
    Our client is going for alpha numeric GL accounts. FS00 will allow creating alpha numeric GL accounts. But i wanted to what may be problem in future?
    I want to know will any account determination settings like OBYC (FI - MM Settings), VKOA (FI - SD settings), AO90 - Asset accounting GL determination or any other FI process will give problem at the time of configurations or in future?.
    Please help me on this. What can be the points on the basis of which i can tell client that they should go for NUMERIC GL accounts only and not Alpha Numeric.

    No other feedback ?
        Avoid using alpha characters – they will create problems in sequencing
    and sorting data in reports, assigning codes, using ranges, and when
    creating validation and/or security rules”
    What does security rules in this context ?

  • TS3276 I need feedback for the following issue. When I send email from this 27 inch iMac, the computer adds a string of characters in vertical column that represents the QWERTY key board, all alpha numeric characters are included. Yahoo mail, issue only o

    Restating my issue / question...
    When I send email from this iMac, there is a string of characters assigned. The characters are all the "alpha numeric" characters on the QWERTY key board. This only occurs when email is sent from this iMac. The issue does not manifest when using any other lap top or computer.
    Hence, I have ruled out the issue is a yahoo mail matter.
    Again, I can access the Yahoo mail account form multiple devices and send email without unintended assignment of character strings, but when I send wmail using this iMac, the issue happens everytime.
    Characters are stacked verticaly in a column. It looks as if all characters (except function keys) are included in the string.
    Any ideas?
    GMc

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It won’t solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    Third-party system modifications are a common cause of usability problems. By a “system modification,” I mean software that affects the operation of other software — potentially for the worse. The following procedure will help identify which such modifications you've installed. Don’t be alarmed by the complexity of these instructions — they’re easy to carry out and won’t change anything on your Mac. 
    These steps are to be taken while booted in “normal” mode, not in safe mode. If you’re now running in safe mode, reboot as usual before continuing. 
    Below are instructions to enter some UNIX shell commands. The commands are harmless, but they must be entered exactly as given in order to work. If you have doubts about the safety of the procedure suggested here, search this site for other discussions in which it’s been followed without any report of ill effects. 
    Some of the commands will line-wrap or scroll in your browser, but each one is really just a single line, all of which must be selected. You can accomplish this easily by triple-clicking anywhere in the line. The whole line will highlight, and you can then copy it. The headings “Step 1” and so on are not part of the commands. 
    Note: If you have more than one user account, Step 2 must be taken as an administrator. Ordinarily that would be the user created automatically when you booted the system for the first time. The other steps should be taken as the user who has the problem, if different. Most personal Macs have only one user, and in that case this paragraph doesn’t apply. 
    Launch the Terminal application in any of the following ways: 
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.) 
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens. 
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid. 
    When you launch Terminal, a text window will open with a line already in it, ending either in a dollar sign (“$”) or a percent sign (“%”). If you get the percent sign, enter “sh” and press return. You should then get a new line ending in a dollar sign. 
    Step 1 
    Triple-click the line of text below to select it:
    kextstat -kl | awk '!/com\.apple/{printf "%s %s\n", $6, $7}' | open -f -a TextEdit 
    Copy the selected text to the Clipboard by pressing the key combination command-C. Then click anywhere in the Terminal window and paste (command-V). A TextEdit window will open with the output of the command. Post the contents of that window, if any — the text, please, not a screenshot. You can then close the TextEdit window. The title of the window doesn't matter, and you don't need to post that. No typing is involved in this step.
    Step 2 
    Repeat with this line:
    { sudo launchctl list | sed 1d | awk '!/0x|com\.(apple|openssh|vix)|org\.(amav|apac|cups|isc|ntp|postf|x)/{print $3}'; sudo defaults read com.apple.loginwindow LoginHook; } | open -f -a TextEdit 
    This time you'll be prompted for your login password, which you do have to type. Nothing will be displayed when you type it. Type it carefully and then press return. You may get a one-time warning to be careful. Heed that warning, but don't post it. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator. 
    Note: If you don’t have a login password, you’ll need to set one before taking this step. If that’s not possible, skip to the next step. 
    Step 3
    launchctl list | sed 1d | awk '!/0x|com\.apple|org\.(x|openbsd)/{print $3}' | open -f -a TextEdit 
    Step 4
    ls -1A /e*/mach* {,/}L*/{Ad,Compon,Ex,Fram,In,Keyb,La,Mail/Bu,P*P,Priv,Qu,Scripti,Servi,Spo,Sta}* L*/Fonts 2> /dev/null | open -f -a TextEdit  
    Important: If you formerly synchronized with a MobileMe account, your me.com email address may appear in the output of the above command. If so, anonymize it before posting. 
    Step 5
    osascript -e 'tell application "System Events" to get name of every login item' | open -f -a TextEdit 
    Remember, steps 1-5 are all copy-and-paste — no typing, except your password. Also remember to post the output. 
    You can then quit Terminal.

  • Removing non-alpha-numeric characters from a string

    How can I remove all non-alpha-numeric characters from a string? (i.e. only alpha-numerics should remain in the string).

    Or even without a loop ?
    Extract from the help for the Search and Replace String function :
    Right-click the Search and Replace String function and select Regular Expression from the shortcut menu to configure the function for advanced regular expression searches and partial match substitution in the replacement string.
    Extract from the for the advanced search options :
    [a-zA-Z0-9] matches any lowercase or uppercase letter or any digit. You also can use a character class to match any character not in a given set by adding a caret (^) to the beginning of the class. For example [^a-zA-Z0-9] matches any character that is not a lowercase or uppercase letter and also not a digit.
    Message Edité par JB le 05-06-2008 01:49 PM
    Attachments:
    Example_VI_BD4.png ‏2 KB

  • How to configure Alpha Numeric No range for the Material Type

    Dear Expert,
    i kindly request for expert help on alpha numeric no range for the Material Type.
    business is looking for material no like 910442208571D. at present we have no range like 9000000000000 to 9999999999999
    how i can configure in the system??
    pl. help me on this
    Thanks a lot
    H shah

    Hi,
    System will not bring alphanumeric number of materials automatically during MM01.
    Check use exit MGA00002 - Material Master (Industry): Number Assignment.
    Also check 2 Function Modules:
    EXIT_SAPLMG02_001 - Customer Exit: Internal Material Number Assignment
    EXIT_SAPLMG02_002 - Customer Exit: External Material Number Assignment.
    Regards,
    Biju K

  • How do I copy/paste full numerical-only account strings into the Projects WebADI template when the account segment fields in the template require use of the dropdown because they're formatted as alpha-numeric values?

    How do I copy/paste full numerical-only account strings into the Projects WebADI template when the account segment fields in the template require use of the dropdown because they're formatted as alpha-numeric values? I'm using the Integrator named "Projects - Transaction Import" and a custom Layout created based on the seeded Layout named "Transaction Import - Accounted". Do I need to somehow change my Layout to make the Document accept numerical values instead of requiring alpha-numeric values? I need to be able to populate the Document with a large amount of transactions and cannot feasibly go through every transaction to add the alpha-valued name of the account segment to every segment that requires it. The segments in particular causing the problem are "Expnd Type" and "Organization Name" which are both alpha-numeric and as such contain the segment number and name; I need to be able to only have to enter the Natural Account Number (6-digit number only) and the Organization Number (5-digit number only).

    How do I copy/paste full numerical-only account strings into the Projects WebADI template when the account segment fields in the template require use of the dropdown because they're formatted as alpha-numeric values? I'm using the Integrator named "Projects - Transaction Import" and a custom Layout created based on the seeded Layout named "Transaction Import - Accounted". Do I need to somehow change my Layout to make the Document accept numerical values instead of requiring alpha-numeric values? I need to be able to populate the Document with a large amount of transactions and cannot feasibly go through every transaction to add the alpha-valued name of the account segment to every segment that requires it. The segments in particular causing the problem are "Expnd Type" and "Organization Name" which are both alpha-numeric and as such contain the segment number and name; I need to be able to only have to enter the Natural Account Number (6-digit number only) and the Organization Number (5-digit number only).

  • EBS search string for check number

    Hello Gurus
    My client is using MT940 FORMAT for EBS,requirement is in a bank statement we are having 10 transactions which are having the same amount for ex:rs.1000 for ten payment transactions. now system is not able to post the document when we import the bank statement.
    I wanted to use search string for check number,  note to payee in bank statement is check number.Please find the below refference
    /EI/400229001       010013
    0000010013
    Reference 010013
    How could i use search string for this i tried but im not getting the solution im getting the following error difference is too large F5 263.
    Appreciated for our help............
    Thanks a lot in advance...............

    Hi Paulo,
    Thanks for the reply. However i have the following setting and it still does not work..
    Mapping -> AB01
    When i do the simulation it shows the Number and the hits and mapping.
    In the Seach String use i have following settings:
    CC 1000
    Interpretation : ALL Interpretation
    Search String : TEST1 ( this is the name that i gave to above search string)
    Target : Posting RUle
    Active checked.
    But still when i upload the bank statement it is posting to Rule AB03 and not AB01
    Also when i try FEBSTS it says no document hits ???
    Your answer is greatly appreciated.

  • Alpha numeric no. range  for PERNR (Employee no.)

    HI,
    Any option for adding alpha numeric no. range  for PERNR (Employee no.)
    RX

    Better you can use Numeric only....
    see the sap help
    External intervals can only contain either letters or numbers, as sorting can differ between platforms (Code page):
    Allowed:  000001 to 999999
                   AAAAAA to ZZZZZZ
    Not allowed:  AAAAAA to 999999

  • Instructions for entering serial number for Elements 13 are to enter 24 alpha/numeric figures.  The SN on the Elements 13 box are 18 numeric only?

    The instructions for downloading Elements 13 are to enter a 24 alpha/numeric serial number.  The serial number on the box is 18 numeric digits.  How can I download without the required number of digits?

    Find your serial number quickly

Maybe you are looking for

  • CURSOR MISALIGNMENT IN CAMERA RAW ? !

    Hello, I am a new photoshop user.  I have discovered an issue in Adobe Camara Raw and I need help to fix it. I am using Windows 8.1 on a Microsoft Surface Pro 3 with an Intel Core i7 1.7 ghz processor and the Intel HD 5000 graphics card.  I am also u

  • ITunes is not syncing all my pictures on my iPhone

    I have iOS5 and iPhone 4s. Itunes is up to date too. I have about 2,000 pictures on my external hard drive that I am trying to sync on my iPhone. I have a 64GB phone. Only 900 of my pictures are uploading. I can view all my pictures just fine on my w

  • HT4061 can't get into my ipad, enter passcode. I never had a passcode from day one

    I can not get into my iPad. The iPad is saying Enter Passcode. I thought they ment my Password so I tried meny times then it kiked me out. I never did have a Passcode at anytime.

  • Trouble in PreparedStatement

    Here is my code, and errfile. The code is very simple. It can run on the windows2000. The errors are reported when it is running on the linux. It has confused me two weeks. My God If you know the answer, please email me. [email protected] import j

  • Books of Business with multiple divisions in same instance

    We are going to be rolling out another division in our current instance of Siebel On Demand. We want to make sure that each division can only see the records that belong to their division. We are thinking about using the opportunity type field on the