Code to check whether a given string contains alphanumeric

Can anyone post the Code to check whether a given string contains only alphanumeric and no special characters

<Rule name='isAlphaNumericString'>
<RuleArgument name='testStr'/>
<block>
<defvar name='counter'>
<i>0</i>
</defvar>
<defvar name='splitString'>
<while>
<lt>
<ref>counter</ref>
<length>
<ref>testStr</ref>
</length>
</lt>
<append name='splitList'>
<substr>
<ref>testStr</ref>
<ref>counter</ref>
<i>1</i>
</substr>
</append>
<set name='counter'>
<add>
<ref>counter</ref>
<i>1</i>
</add>
</set>
</while>
<ref>splitList</ref>
</defvar>
<containsAll>
<list>
<s>A</s>
<s>B</s>
<s>C</s>
<s>D</s>
<s>E</s>
<s>F</s>
<s>G</s>
<s>H</s>
<s>I</s>
<s>J</s>
<s>K</s>
<s>L</s>
<s>M</s>
<s>N</s>
<s>O</s>
<s>P</s>
<s>Q</s>
<s>R</s>
<s>S</s>
<s>T</s>
<s>U</s>
<s>V</s>
<s>W</s>
<s>X</s>
<s>Y</s>
<s>Z</s>
<s>a</s>
<s>b</s>
<s>c</s>
<s>d</s>
<s>e</s>
<s>f</s>
<s>g</s>
<s>h</s>
<s>i</s>
<s>j</s>
<s>k</s>
<s>l</s>
<s>m</s>
<s>n</s>
<s>o</s>
<s>p</s>
<s>q</s>
<s>r</s>
<s>s</s>
<s>t</s>
<s>u</s>
<s>v</s>
<s>w</s>
<s>x</s>
<s>y</s>
<s>z</s>
<s>0</s>
<s>1</s>
<s>2</s>
<s>3</s>
<s>4</s>
<s>5</s>
<s>6</s>
<s>7</s>
<s>8</s>
<s>9</s>
</list>
<ref>splitString</ref>
</containsAll>
</block>
</Rule>
It Retruns 1 if it contains only alphanumeric otherwise 0

Similar Messages

  • How to check whether a char string is in uppercase or not

    Hi,
    I know how to convert strings to change strings to uppercase or lowercase, but is there any function to check, beforehand, if the field is in uppercase, for instance ? The intention here is simply to spare processing in situations where the string is already in uppercase, and thus not needing any further processing (given I want to turn the string into uppercase.)
    Thanks in advance,
    Avraham

    Hi Avraham ,
    To check whether the string is in upper case or not use CA keyward.
    To check  try the following code  ---
    DATA : W_STRING(5) TYPE C,
    W_ABCDE(26) TYPE C VALUE 'abcdefghijklmnopqrstuvwxyz'.
    w_string = 'abcd'.
    IF W_STRING CA W_ABCDE.
    TRANSLATE w_string TO UPPER CASE.
    ELSE.
    MESSAGE 'It is a uppercase string' TYPE 'S'.
    ENDIF.
    Try this link  this will definitely help you -
    https://wiki.sdn.sap.com/wiki/display/ABAP/Validationofastringintermsof+case
    Regards
    Pinaki

  • Sample code to check whether a particular resource is provisioned in OIM11g

    Hi,
    I would like to check whether AD resource is provisioned or not for a given user. If so, I would like to add a group to it.
    Can you please provide me some sample code for this scenario. I am using oim 11g.

    Hi
    Here is some sample code:
    tcResultSet userSet = userAPI.findUsers(userSearchMap);
                   if (userSet.getRowCount() <= 0) {
                        System.out.println("User not found in OIM:-" + userID);
                        continue;
                   userSet.goToRow(0);
                   long userKey = userSet.getLongValue("Users.Key");
                   tcResultSet userObjSet = userAPI.getObjects(userKey);
                   for (int i = 0; i < userObjSet.getRowCount(); i++) {
                        userObjSet.goToRow(i);
                        if (roName.equalsIgnoreCase(userObjSet
                                  .getStringValue("Objects.Name"))) {
                             objStatus = userObjSet
                                       .getStringValue("Objects.Object Status.Status");
                             long oiu_key = userObjSet
                                       .getLongValue("Object Instance.Key");
                             if (!("Provisioned".equalsIgnoreCase(objStatus)
                                       || "Disabled".equalsIgnoreCase(objStatus) || "Enabled"
                                       .equalsIgnoreCase(objStatus))) {
                                  continue;
    Regards
    user12841694

  • Code to Check for Special Characters \/:*?" | in the given String

    Hi All,
    I need a java code to verify if the given string contains the Special Characters like \/:*?"<>|
    thanks
    krishnaveni

    http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
    bye
    TPD

  • Check whether logged in user has admin previleges

    Hi,
    Can anyone share c# code that checks whether the logged in user is Farm administrator.
    Thanks in advance

    Hi 
    You can check using below code 
    public static bool IsFarmAdmin(string loginName)
                bool isFarmAdmin = false;
                SPSecurity.RunWithElevatedPrivileges(delegate()
                    SPGroup adminGroup = SPAdministrationWebApplication.Local.Sites[0].AllWebs[0].SiteGroups[“Farm Administrators”];
                    foreach (SPUser user in adminGroup.Users)
                        if (user.LoginName == loginName)
                            isFarmAdmin = true;
                            break;
                return isFarmAdmin;
    below is reference for the same
    https://social.msdn.microsoft.com/Forums/office/en-US/1fa3287a-c732-4924-b75d-fec493446389/checking-if-a-given-user-is-farm-administrator?forum=sharepointdevelopmentlegacy
    or this
    Some possibly easier ways would be the following:
    bool isSiteAdmin = SPContext.Current.Web.UserIsSiteAdmin;
    isSiteAdmin = SPContext.Current.Site.UserIsSiteAdminInSystem;
    bool isFarmAdmin = SPFarm.Local.CurrentUserIsAdministrator();
    https://social.msdn.microsoft.com/Forums/office/en-US/9ecf128b-a2b9-4669-b86c-aaaba19ff97d/how-to-determine-if-a-user-is-site-collection-or-farm-admin-in-the-webpart-c-code?forum=sharepointdevelopment
    Regards, Rajendra Singh If a post answers your question, please click Mark As Answer on that ost and Vote as Helpful http://sharepointundefind.wordpress.com/

  • How to check whether a vriable is declared or not?

    Hi,
    Problem:
    A glogal variable named :GLOBAL.ENV is used in one of my form.
    But its value is coming from another form which is developed by another programmer.
    I need to check like this:
    IF :GLOBAL.ENV='SOMETHING' THEN
    END IF;
    But, if the other developer doesn't assign a value for the global variable, i am getting an error like this:
    FRM-40815: Variable GLOBAL.ENV does not exists
    So, i need to know whether the GLOBAL.ENV already exists before using it in my form.
    That is, i need to do like this:
    IF (code to check whether GLOBAL.ENV exists ) then
    use GLOBAL.ENV
    ELSE
    Assign a default value to GLOBAL.ENV
    END IF;
    Thanks for your time...

    Thank you very much...
    I used DEFAULT_VALUE('def val','GLOBAL.ENV');
    Now the problem is solved.

  • String contains special chars

    Hi there,
    If given string contains a special character in the first position..i need to delete the character from the string.
    please suggest a way..

    It's clunky, but try this:
    To replace special character with space.
    data:  w_val type string.
    move old_string+0(1) to w_val.
    replace first occurance of w_val in old_string with space.
    OR
    To remove it entirely
    shift old_string by 1 places left.    " Shifts string to left and drops off characters to left.
    Steve

  • Check whether there is nodes inside a xml node

    I am trying a few different way, but i can't get the point,
    hope some expert can help me on this.
    eg:
    <product>
    <item>
    </item>
    </product>
    <cfscript>
    <!--- after xml parse to xmlElement --->
    if (xmlElement.product.item neq ""){
    writeOutput(xmlElement.product.item[1]);
    But this wont work for me, anyone know how to check whether a
    xml node contains child nodes or not?

    xmlSearch()?
    Adam

  • How to check whether a field contains at least one numeric value

    how to check whether a field contains at least one numeric value..

    Hi,
    I hope that this code will works.
    constants:
       c_digit_grp        TYPE char11         VALUE '0123456789',        " Digit group
    * Data Declaration
    data :
      str   type string.
    * if you want check entire string and pass entire string
    if  str CA c_digit_grp.
    * write your logic ---this block will execute atleast one numeric value exists in the string
    Endif.
    Regards
    Bhupal Reddy

  • [req] how to check whether given oracle table exist or not + C#

    Hi,
    All.
    Actually i m creating a program using C# which connects to the database (oracle) and checks for the given table "OPC_GROUP". if the table doesnt exists then it creates the table else it updates all field with provided values
    code
    cmd.CommandText = "SELECT tname from tab where tname = 'OPC_GROUP'";
    cmd.CommandType = CommandType.Text;
    int length = cmd.ExecuteNonQuery();
    if (cmd.ExecuteNonQuery() >0)
    MessageBox.Show("Table does exist");
    else
    MessageBox.Show("Table doesnt exist");
    But this code return "TABLE DOESNT EXIST" though table is already created
    What i m doing wrong???
    Please help..........
    Thnx in advance

    Try this..
    cmd.CommandText = "SELECT count(*) from tab where tname = 'OPC_GROUP'";
    cmd.CommandType = CommandType.Text;
    string strnum = cmd.ExecuteScalar().ToString();
    if (strnum!="0")
    MessageBox.Show("Table does exist");
    else
    MessageBox.Show("Table doesnt exist");
    Hope it helps,
    Greg

  • How to find out whether the String contains chinese characters

    I need to check if the string contains chinese characters in Java. Does anyone know how to do it? thx.

    Since Java strings contain UNICODE code points, check the content against the relevant page here - http://www.unicode.org/charts/ .

  • Find Whether String Contain Sequence Of Character Or Not

    <b>
    hello friend,
    I am to the new java. I need to findout whether the string contain sequence of character or not. I tried like this
    personLastName.length()> 0
    It will return true even my string contains space. Is there any other method in java to find out ?
    Thanks

    There are a few ways to do that. Check out the String class or Regex for one that suits but
    myString.indexOf(whatIWantToFindString)is an old favorite. It returns -1 if the sequence is not there, or the starting index if it is. The javadocs are your friends.
    regards

  • Need reg_exp for checking the string contains only alphanumeric or not

    Dear All,
    I need to check the given string in if condtion contains only the alphanumeric or not pls help me..
    like
    if reg_exp then
    end if;
    thanks,
    Oracle

    Hi,
    REGEXP_LIKE ( str
                , '[^[:alnum:]]'
                )returns TRUE if the string str contains any character other than an alphanumeric.
    You can use this wherever conditions are allowed, such as a WHERE clause or a CASE expression. For example:
    SELECT     str
    .     CASE
             WHEN  REGEXP_LIKE ( str
                         , '[^[:alnum:]]'
             THEN  'Contains speace, punctuation or special symbol'
             ELSE  'Okay'
         END               AS is_alnum
    FROM     table_x
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using.
    Edited by: Frank Kulash on Dec 30, 2011 4:37 AM

  • Check whether there is any Special Characters in a String ?

    Hi All,
    I am having a very large String. I like to know how to check whether there is any special characters present in a string
    Thanks,
    J.Kathir

    I am having a very large String. I like to
    I like to know how to check whether there is any
    special characters present in a stringAll characters are special in a way. You shouldn't just single a few out because they don't look "normal" to you. Maybe they have golden hearts?

  • How to poll directory to check whether new file is added in plsql code

    How to poll directory to check whether new file is added in plsql code

    You can simply try opening that file for read in a loop (with some sleep in between). But in some OS (e.g. UNIX) file is accessible even if it is partially written. I suggest creating OK file (empty file with same name and OK as extension) after creating main file. This way PL/SQL code will be polling for OK file which means main file is completed.
    SY.

Maybe you are looking for