Find special characters in string (using mask)

Hi all,
I have the following requirement, perhaps someone has got a hint for me:
I have got a string of 255 characters.
I want to realize that this string only contains characters of a "normal" format, like
a-z, A-Z and numbers.
Any characters like , - # for example are not allowed and I would like to know, how to check my string.
How can I achive that? With FIND or SEARCH?
I am not really familiar with these ABAP KEY WORDS. Can I use masks for example like
DATA:  no_good type c value '[#,+,*...)
FIND no_good in STRING
or something like that?
Thanks and best regards
Andreas

Hi Try the below code:
data: l_data(10) type c,      
      l_special(10) type c.
l_data = 'AAA%%AA'.          " You can give your value here
L_special = '!@#$%^&*()'.     " This need to be maintained wth the char which you don't want
IF l_data ca l_special.
WRITE: 'Special'.
else.
WRITE: 'Only ALPHA.'.
ENDIF.
P.S. - @ Rob, sorry I haven't check you have already given this as CO. Just a doubt, I think we have to use CA here, because we need to check this for each byte level.
Edited by: Kuntal Nandi on Mar 30, 2009 2:55 PM

Similar Messages

  • How can I find special characters in a string

    Hi,
    I have a small task where I have to find special characters in a given string, Can anyone suggest.......................

    What is your definition of a "special character", could you be a bit more specific?
    Do you simply want to find the position of a specific character in the string?
    Can it occur more than once and you want to find all occurences?
    What should happen if the special character does not exist?
    For programming purposes, all 256 possible 8 bit characters (x00-xFF) can be treated the same. Non-printing characters can be entered in \-codes or hex display if needed.
    LabVIEW Champion . Do more with less code and in less time .

  • Replace special characters in String

    Dear Guru ,
    Does SAP provide the standard function that can replace the special characters in String ?
    For example :
    I have one template string : " & & & & & output(s) have not been processed yet ! " and five parameters : "P1" , "P2" , "P3" , "P4" , "P5" .
    And i would like to apply all parameters into the string to replace the "&" character . Is it possibile ?
    My idea is sourcing from the Message String that in tcode : SE91 .
    Thanks .
    Best Regards,
    Carlos Zhang

    Hi Carlos,
    I think instead of a standard FM you can write a one line command to do this job.
    E.g. 
    constant: str1 type string value 'output(s) have not been processed yet ! '.
    data: var1 type c,
             var2 type c,
             var3 type c,
             var4 type c,
             str    type string.
    concatenate var1 var2 var3 var4 str1 into str separated by space.
    So str will have the final value.
    Thanks,
    Mainak

  • Finding special characters in a columns using SQL

    Hi,
    I have a column (Object_Name) which accepts character values. I want to find out such kind of records which has special charaters in my columns Object_Name. Please let me know, how do I write SQL statement for the same.
    Thanks for your time in advance.

    To find, for example, a comma in the OBJECT_NAME column try:
    SELECT OBJECT_NAME
      FROM MYTABLE
    WHERE INSTR(OBJECT_NAME,',')>0;To find multiple special characters, for example @ # + - _ , . : ; at same time try:
    SELECT OBJECT_NAME
      FROM MYTABLE
    WHERE INSTR(TRANSLATE(OBJECT_NAME,'@#+-_,.:;','@@@@@@@@@'),'@')>0;add a @ to the string '@@@@@@@@@' each time you add a character to the string '@#+-_,.:;'
    max

  • Finding special characters in a string

    Hi all, I'm using Oracle 10g.
    I have a column name with special characters. how can i replace the special characters in the column with space and no space depending on the special character. please see the example below. can i use REGEXP_REPLACE?
    create table
    create table sample_test (
      Name    VARCHAR2(20 BYTE))insert table
    insert into sample_test values ('O''NEIL')
         insert into sample_test values ('B.E.VICTOR')
          insert into sample_test values ('WILLIAM,L')
           insert into sample_test values ('MARY-ANNE')
               insert into sample_test values ('VON_ANCKEN')
                insert into sample_test values ('BROWN;L')i would like the output as follows
    Special Character         Name         Expected Name                  Remarks     
    Single Quotes            O'NEIL                  ONEIL                          Remove quotes and no space       
    Dot                      B.E.VICTOR         B E VICTOR                          Replace with space       
    Comma                      WILLIAM,L         WILLIAM L                          Replace with space       
    Hyphen                      MARY-ANNE         MARY ANNE                          Replace with space       
    Underscore                VON_ANCKEN         VON ANCKEN                          Replace with space       
    Semi Colon              BROWN;L          BROWN L                          Replace with space      Please advise.
    Thanks
    Bob

    A simple solution without regexp usage:
    -- Test Data
    with sample_test as
    select 'O''NEIL' name from dual union all
    select 'B.E.VICTOR'  name from dual union all
    select'WILLIAM,L' name from dual union all
    select'MARY-ANNE' name from dual union all
    select'VON_ANCKEN' name from dual union all
    select'BROWN;L' name from dual
    -- Query:
    select name old_name,
           translate(replace(name,'''',''),'.,-_;','     ') new_name
    from sample_test;Explanation:
    REPLACE deletes the quote
    TRANSLATE replaces dot, comma, hyphen, semicolon and underscore

  • Dynamic SQL Query to Find Special Characters in Table columns

    Hi,
    I am new to OTN FORUMS.
    I am trying to find the columnsi of a table which have special characters in them.
    I am planning on using this query
    select ' select INSTR('||column_name||', chr(0))
    from '||table_name||'where INSTR('||column_name||', chr(0)) >0' from user_tab_columns
    where table_name='Account'
    and spool the output to run as a script.
    Is this the right way or do u suggest any modifications to the query?
    Thanks in advance.

    Hi,
    I think your basic approach is right. Since you can't hard-code the table- or column names into the query, you'll need dynamic SQL.
    Instead SQL-from-SQL (that is, writing a pure SQL query, whose output is SQL code), you could do the whole job in PL/SQL, but I don't see any huge advantage either way.
    When you say "Special character<b>s</b>", do you really mean "one given special character" (in this case, CHR(0))?
    Will you ever want to search for multiple special characters at once?
    What if table foo has a column bar, and in 1000 rows of foo, bar contains CHR (0). Do you want 1000 rows of output, each showing the exact position of the first CHR(0)? If the purpose is to look at theese rows later, shouldn't you include the primary key in the output? What if CHR(0) occurs 2 or more times in the same string?
    If you'd rather have one row of output, that simply says that the column foo.bar sometimes contains a CHR(0), then you could do something like this:
    SELECT     'foo',     'bar'
    FROM     dual
    WHERE     EXISTS (
                SELECT  NULL
                FROM       foo
                WHERE       INSTR ( bar
                            , CHR (0)
                        ) > 0
                );

  • How to find Special Characters in a single query

    Dear Experts,
    Your usual help is required to solve the query.My query is "How to find all special characters like (%$*&@,;'/+- etc. in a single query?"
    Thanks.
    e.g.
    A_MIR
    A%SIM
    A*SIM
    A)SIM

    Hi,
    947459 wrote:
    Dear Experts,
    Your usual help is required to solve the query.My query is "How to find all special characters like (%$*&@,;'/+- etc. in a single query?"
    Thanks.
    e.g.
    A_MIR
    A%SIM
    A*SIM
    A)SIMIt's not clear what you want.
    What are "special characters"? Can you list all of them?
    Do you want to find rows where string_column contains any of the special characters? If so
    SELECT     string_column
    FROM     table_x
    WHERE     string_column     != NVL ( TRANSLATE ( string_column
                                        , 'A(%$*&@,;'/+-'
                                , 'A'
                          , 'A'
    ;I assume 'A' is not a special character.
    You could also use regular expressions, but it will be more efficient if you don't use them unless you really need to.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements), 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 (e.g. 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}
    You'll get better replies sooner if you always include this information whenever you have a question.

  • How to replace special characters in string.

    Hello,
    I want to replace special characters such as , or ; with any other character or " ".I find out there is no such function is java for this.There is only replace() but it accepts only chars.If anybody know how to do this?.
    Thanks,

    Hello,
    I want to replace special characters such as , or ;
    with any other character or " ".I find out there is no
    such function is java for this.There is only replace()
    but it accepts only chars.If anybody know how to do
    this?.
    Thanks,Can't you just do the following?
    public class Test
         public static void main(String[] args)
         String testString = "Hi, there?";
         System.out.println(testString.replace(',',' '));
    }

  • How special characters can be used in xml element TAG.

    Hi,
    In my project data is fetched from the database and stored in the xml file. Data contains European characters as well. When I tried with UTF-8 it was giving error but when I changed the encoding to ISO-8859-1, XML generated.
    Well now I am stuck with a problem and as I don�t know much about XML, I am trying to get some knowledge from you.
    I have xml tag like: <Name&>Rohit</Name><employee#>78023</employee>.
    I am getting the error message �top level element must be defined.� This is because special characters are in TAG. But it doesn�t give error if I use special characters/European char in value( like Rohit*).
    I don�t know much about CDATA. Any help from your end will be greatly appreciated.Can this problem resolved if i use java function outformat.CDataElements(String[]) and pass the elements name.
    Thanks!!
    Regards,
    Rohit Dutt

    Client: I want this element name.
    You: The XML recommendation doesn't allow you to have that element name. If you make documents with that element name then no XML software will be able to read them. It just isn't going to work. Insisting on that would just be stupid and pointless. (Okay, you don't say that last sentence that way to your client but that's how it is. Explain it more nicely than that.)

  • Remove special characters in string

    Hi all,
    I'm Portuguese, and in our language we use special characters in words like "João or "Sónia".
    I need to take off these special characters, which means I want to have the same words like "Joao" and "Sonia", without the characters "~" or "´".
    Do you have any idea how can I do this?
    Thanks in advance.
    Best regards,
    Sónia Gonçalves

    Hi,
    But I want to make this generic, I don't want to replace character by character.
    If I give a string in the program, I want to search all ocurrences of these special characters and replace them.
    How can I do this?
    Thanks.
    Best regards,
    Sónia Gonçalves

  • Restrict Special Characters in String Fields

    Hello,
    My Jdev version is 11.1.1.6 using ADF BC and ADF Faces as technology stack.
    I have a requirement to restrict special characters, html tags as input in String/Varchar2 fields.
    I have couple of thoughts that can be used in application but not sure which is the best approach:
    1. Implement <af:validateRegExp pattern="regular Exp"> inside <af:inputText> component
    2. Implement Entity based validator using Regular Expression
    Apart from picking the best out of above two, I would like to know if there is a better way to implement this validation.
    My application has custom framework extn classes and all Entities/View Objects extend those. Is there a possibility to implement this type of validation at some central place.
    I would highly appreciate expert inputs here.
    Thanks,
    Jai

    Hi,
    the answer to your question is *"use both"*. The entity level would be enough but then would make people subniitting a request afte which they see an error The RegEx validator in ADF Faces handles problems on the client side and thus before a submit is sent to the server (where it then would be also checked using server side validation in ADF Faces). Why not using RegEx validation in ADF faces alone? Because there are potentially many views accessing your entity through view objects and if only one developer forgets the RegEx validator you would be screwed.
    Frank

  • How to find Special Characters in a table ?

    Hi,
    I have a problem, during a data upload by the client, some special characters were uploaded in the database.
    Sample data : " AC Power Cord Denmark "
    I want to find all records containing such special characters and update them.
    TOAD is able to display these characters but when i copy them onto the query... it doesnt work.
    Can we know which encoding is that ? or do something to take care of this ?
    Thanks in Advance.
    Message was edited by:
    Champ

    insert into t1 values ('joe$%"likes#$%#to*()ride%^$#his bike');
    1 rows inserted
    select * from t1;
    C1                                                                                                  
    joe$%"likes#$%#to*()ride%^$#his bike                                                                
    1 rows selected
    select translate(c1,'!@#$%^&*()"','          ') from t1;
    TRANSLATE(C1,'!@#$%^&*()"','')                                                                      
    joe  likes    to   ride    his bike                                                                 
    1 rows selected
    update t1 set c1 = translate(c1,'!@#$%^&*()"','          ');
    1 rows updated
    select * from t1;
    C1                                                                                                  
    joe  likes    to   ride    his bike                                                                 
    1 rows selectedI didn't notice your special special characters, but it still works:
    insert into t1 values ('joe likes his'||chr(22));
    select * from t1;
    select translate(c1,chr(22),' ') from t1;
    update t1 set c1 = translate(c1,chr(22),' ');
    select * from t1;
    Message was edited by:
    JoeC

  • How to Avoid Special Characters in string

    Hai.
    I want only Alphabets & Digits to be entered in to my string.No any other special characters except spaces.How can I do this? 
    Solved!
    Go to Solution.

    MikeS81 wrote:
    see the attached example.
    I would allow a few more, e.g. 0 and 8 to allow editing of the entered string (backspace, cursor buttons, delete key, etc.).
    Message Edited by altenbach on 11-21-2008 12:49 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    check_char_LV80MOD.vi ‏14 KB
    FilterStringInput.gif ‏6 KB

  • How to write special characters in PDF using iText

    How to write special characters encoded with UTF-8 in PDF using iText.
    Regards,
    Pandharinath.

    I don't know what your problem is but that's almost certainly the wrong question to ask about it. Java (including iText) uses only Unicode characters. (You may consider some of them to be "special" if you like but Unicode doesn't.) And when it does that, they aren't encoded in UTF-8 or any other encoding.
    So can you describe your problem? That question doesn't make sense.

  • OID/Portal - Restrict Special Characters to be used in Password

    Hi,
    Does anyone know how I can restrict the use of special characters ($, &, £...etc) in the OID password? I cannot see an attribute to achive this? orclpwdIllegalValues will stop certain words, but I just want to restrict the use of any of the special characters in any password. All suggestions or information would be much appreciated.
    Thanks

    Requires custom plugin (using PL/SQL) to add password value checking to OID password policy management capabilities. A description and example code for this is available in chapter 27 of the Oracle® Internet Directory Administrator's Guide, 10g Release 2 (10.1.2) entitled "Oracle Internet Directory Plug-In for Password Policies" available at http://download.oracle.com/docs/cd/B14099_19/idmanage.1012/b14082/plugin_pwdpolicies.htm#i122359

Maybe you are looking for