Find characters A-Z in a string

Hi,
I have a alphanumeric string. In some cases the string does only contain numbers, no characters.
Example for the string:                                123 432 234A
OR without characters                               123 432 234
How can I check if the string does contain any characters? I could use the "FIND"-command to look for a single character, but there should exist a way to do it in a kind of range (A-Z).
Thanks for your help,
Christoph

Hi Christof,
Try this code:
Declare constant containing all 26 letters of the alphabet
DATA: v_abcd(27) TYPE c VALUE ' QWERTYUIOPASDFGHJKLZXCVBNM'.
PARAMETERS: v_string TYPE string.
IF v_string CA v_abcd.
  WRITE: 'Alphabets present'.
ELSE.
  WRITE: 'Alphabets absent'.
ENDIF.
Hope this helps! Do revert if you need anything else!!
Cheers,
Shailesh
Always provide feedback for useful answers

Similar Messages

  • Find characters in a string....

    Hello, I have trouble writing the syntax for checking if some characters are part of a string.
    I want this to function:
    Return true (or the characters in question), otherwise null or false.
    For example: check if '1Y' is part of 'NOKLIB 1Y' (true in this case).
    I work with this code:
    select substr('2Y','1',INSTR('NOKLIB 2Y'),'1') from dual
    [\code]
    All help greatly appreciated!
    many thanks
    Harald                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    not sure what you want but may be this?
    SQL>  SELECT CASE
      2            WHEN LENGTH (REPLACE (str, '2Y') ) = LENGTH (str) THEN 'FALSE'
      3            ELSE 'TRUE'
      4          END output
      5     FROM (SELECT 'NOKLIB 2Y' str
      6             FROM DUAL
      7           UNION ALL
      8           SELECT 'NOKLIB'
      9*            FROM DUAL)
    SQL> /
    OUTPU
    TRUE
    FALSEor this?
    SQL> SELECT CASE
      2           WHEN INSTR (str, '2Y') = 0 THEN 'FALSE'
      3           ELSE 'TRUE'
      4         END output
      5    FROM (SELECT 'NOKLIB 2Y' str
      6            FROM DUAL
      7          UNION ALL
      8          SELECT 'NOKLIB'
      9*           FROM DUAL)
    SQL> /
    OUTPU
    TRUE
    FALSEFormatted
    Message was edited by:
    devmiral

  • Find and replace value in Delimited String

    Hi All,
    I have a requirement, where i need to find and replace values in delimited string.
    For example, the string is "GL~1001~157747~FEB-13~CREDIT~A~N~USD~NULL~". The 4th column gives month and year. I need to replace it with previous month name. For example: "GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~". I need to do same for last 12 months.
    I thought of first devide the values and store it in variable and then after replacing it with required value, join it back.
    I just wanted to know if there is any better way to do it?

    for example (Assumption: the abbreviated month is the first occurance of 3 consecutive alphabetic charachters)
    with testdata as (
    select 'GL~1001~157747~FEB-13~CREDIT~A~N~USD~NULL~' str from dual
    select
    str
    ,regexp_substr(str, '[[:alpha:]]{3}') part
    ,to_date('01'||regexp_substr(str, '[[:alpha:]]{3}')||'2013', 'DDMONYYYY') part_date
    ,replace (str
             ,regexp_substr(str, '[[:alpha:]]{3}')
             ,to_char(add_months(to_date('01'||regexp_substr(str, '[[:alpha:]]{3}')||'2013', 'DDMONYYYY'),-1),'MON')
    ) res
    from testdata
    STR
    PART
    PART_DATE
    RES
    GL~1001~157747~FEB-13~CREDIT~A~N~USD~NULL~
    FEB
    02/01/2013
    GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~
    with year included
    with testdata as (
    select 'GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~' str from dual
    select
    str
    ,regexp_substr(str, '[[:alpha:]]{3}-\d{2}') part
    ,to_date(regexp_substr(str, '[[:alpha:]]{3}-\d{2}'), 'MON-YY') part_date
    ,replace (str
             ,regexp_substr(str, '[[:alpha:]]{3}-\d{2}')
             ,to_char(add_months(to_date(regexp_substr(str, '[[:alpha:]]{3}-\d{2}'), 'MON-YY'),-1),'MON-YY')
    ) res
    from testdata
    STR
    PART
    PART_DATE
    RES
    GL~1001~157747~JAN-13~CREDIT~A~N~USD~NULL~
    JAN-13
    01/01/2013
    GL~1001~157747~DEC-12~CREDIT~A~N~USD~NULL~
    Message was edited by: chris227 year included

  • Here's how to find the right word in a string

    I needed to find the rightmost word in a string. I didn't find a simple formula in these forums, but I now have one, so I wanted to share it. Hope you find it useful.
    Assuming that the string is in cell A1, the following will return the rightmost word in the string:
    RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))

    I found the problem. Whatever character was being used in the substitution was parsed out by the forum parser. I replaced it with "œ" (option q on my keyboard).
    =RIGHT(A1,LEN(A1)-FIND("œ",SUBSTITUTE(A1," ","œ",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))
    Still needs an error check for a single-word "sentence" and to remove the trailing period but it does seem to work. Pretty slick.
    Message was edited by: Badunit
    I see below that the problem was fixed by the OP.
    Message was edited by: Badunit

  • How to find MATCH count for #  in a String

    Hi all,
    How to find MATCH count for #  in a String.
    Ex:  6170#0400-0002-00#API3PT#AL#AUST#DEVE#KG#100.00#100.00#100.00#0.00##10.20
    Regards,
    Balavardhan.K

    >
    balavardhan k wrote:
    > I have used below syntax to find count but it is not returning the value and SY-SUBRC  = 4.
    >
    >
    > Data : l_text type string.
    >
    > l_text = '6170#0400-0002-00#API3PT#AL#AUST#DEVE#KG#100.00#100.00#100.00#0.00##10.20'.
    >
    >
    > FIND ALL OCCURRENCES OF '#' IN L_TEXT MATCH COUNT mcnt .
    Then it's not a # but possible a horizontal tab-sign.
    Do a find on cl_abap_char_utilities=>horizontal_tab instead.
    Edited by: Maen Anachronos on Nov 23, 2010 2:48 PM

  • Random Characters insterted into Crystal Reports string fields

    I'm having a problem where random characters are being inserted into string fields in my crystal reports, I talked to a representative and they are unable to fix the problem, so I'm asking here if someone has a workaround.  The characters are always outside of the normal set of characters, so I'd like to know if there is a way to only allow certain characters in a given field using formulas.  (for example, at a very simple level, i would input a list of "legal characters" and the field in crystal wouldn't display anything but those characters)
    thanks for your time and help

    Sorry, i think I've been a bit imprecise so far
    So these characters ONLY appear when printing the report and not when previewing the report in Crystal Reports?
    They appear when previewing, when actually printing, everything after the characters is cut off
    Are you printing directly from CR or from Enterprise/Infoview or another custom application?
    From CR (both to PDF and paper)
    When did you update your print driver last?
    Not sure, although this may be moot since it also shows up in the preview?
    Have you printed on another printer and does it too exhibit the same behavior?
    Same as above?
    Was the report created by you in CRXI? Are your regional settings set to English (language)?
    Yes I created the report in CRXI, and in terms of the regional settings, I'm not sure but would assume so, how do I check/change this?

  • Error when access instrument "Primary Error: (Hex 0xBFFA003D​) Unable to find any channel or repeated capability strings"

    Hi All,
    I believe I have configured MAX correctly. I am trying to use the PXI-6229 device via. When I try initialized I receive the following error:
    Primary Error: (Hex 0xBFFA003D) Unable to find any channel  or repeated capability strings.
    Any clues on what the error means?
    Thanks
    Minesh
    Solved!
    Go to Solution.

    First of all you'll get more help in the correct forum.  This seems like a DAQmx issue and their forum is here: http://forums.ni.com/t5/Multifunction-DAQ/bd-p/250
    Secondly does this help: http://forums.ni.com/t5/Switch-Hardware-and-Softwa​re/NI-SwitchExec-with-3499-and-IVIDriver/td-p/1827​...
    Lastly: Can you communicate with the card from MAX?  Or is the error happening in MAX?  What language are you using to talk to the card with?  Are you using IVI?  If you are using LabVIEW or CVI then open the shipping examples and test them out with that card.
    Regards,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • How we can find the last character in a string(Urgent Plz!)

    Gurus!
    How we can find the last character in a string.
    e.g i have a string say "Str" with value "10-01".
    Now i want to find the last character in "Str" i.e "ONE=1".
    i am using Oracle developer 6i with Oracle 8i(1.7).
    Plz help!
    Many thanks!

    Use the substr() and length() functions -
    x := '10-01';
    y := substr(x, length(x));

  • How to find as ascii value for a string or char in unicode system?

    Hello,
    How to find an ascii value for a string or char in unicode system?
    Thanks in Advance

    hi ,
    report demtest.
    data : c.
    field-symbols : <n> type x.
    data : rn type i.
    c = 'A'.
    assign c to <n> casting.
    move <n> to rn.
    write rn.
    This will convert 'A' to 65.
    Tom Demuyt
    How to convert ascii value to character.
    If I give input as 65 (ascill value) I want display 'A'.
    Below logic is for convert from character to ascii value , now I want to know how to convert ascii value to character.
    Naveen
    report demtest.
    *going from A to 65
    data : c value 'A'.
    field-symbols : <n> type x.
    data : rn type i.
    assign c to <n> casting.
    move <n> to rn.
    write rn.
    *going from 66 to B
    data : i type i value 66.
    data : x type x.
    field-symbols : <fc> type c.
    move i to x.
    assign x to <fc> casting type c.
    move <fc> to c.
    write c.
    regards,
    venkat.

  • How find shape containing all pixels in string drawn at angle?

    I've drawn a string on a JPanel at an angle using the code below. I want the mouse to turn into a hand when hovering over it but I don't know how to find the shape that an angled string comprises. (I can do it if it's written horizontally). How would I calculate that?
    double theta = Math.toRadians( angle );
    AffineTransform transform = AffineTransform.getRotateInstance( theta );
    ( ( Graphics2D ) graphics ).setTransform( transform );
    graphics.drawString( text, x, y );

    For the String you can create a Rectangle where the String is contained when it has no rotation. After that you can create Area (see java.awt.geom.Area) from the Rectangle and use transform() method of area to get a rotated one. Then just use contains() method.
    Regards,
    Stas

  • Find the nth occurrence of a string in a string

    Hi,
    I'm wondering if there is a method like indexOf, but finds the nth occurrence of a string
    public static int occurrence(java.lang.String str,
                                 java.lang.String toFind,
                                 int occurrence)Cheers
    Jonny

    phdk wrote:
    calypso was refering to promes pseudo code.What is promes? I don't understand the word. Sorry!
    I put the global variable 'count' now in the method occurence
    public static int occurence(String str, String toFind, int occurence){
            int origLength = str.length();
            int count = 0;
            while(str.length()>0){
                str = contains(str, toFind, count);
                   if(count == occurence){
                    int length = str.length();;
                    int actualPos = origLength-(length+1);
                    return actualPos;
                   count++;
            return -1;
    public static String contains(String str, String toFind, int count){
            int occurence = str.indexOf(toFind);
            if(occurence != -1 ){
                 count = count+1;
                return str.substring(occurence+1,str.length());
            }else{
                return "";
      }The output is 1 position to high.
    I still don't get which part of the code to replace with this pseudo code: s'.indexOf('toFind', 'index'+1)
    Sorry for being dimwitted!
    Thanks
    jonny

  • How to find which junk characters are there in the string

    Hi Guys in my employee table ,I have a field name emp_name
    and the data inside one of the record is 'BUSH ';
    after trimming it ... length(trim(emp_name)) ... I expected the length to be 4,but it still returns 5.So I am wondering what that extra characters after H is.
    Can some one tell me how to find it.
    thanks in advance.

    Hmmm. What you describe is not the behaviour I would expect from a CHAR(10) column. I would expect this:
    SQL> CREATE TABLE bt (col1 CHAR(10));
    Table created.
    SQL> INSERT INTO bt VALUES ('BUSH ');
    1 row created.
    SQL> SELECT length(col1) FROM bt;
    LENGTH(COL1)
              10
    SQL> SELECT length(trim(col1)) FROM bt;
    LENGTH(TRIM(COL1))
                     4
    SQL> What version of the database are you using? Also, what does this query give you?
    SELECT ascii(substr(ename, 5,1))
    FROM emp
    WHERE  substr(ename,1,4) = 'BUSH';Cheers, APC

  • Finding the total size of a string when number of characters are known.

    Hi: I am having trouble inserting a field in a record that is CLOB. The number of characters in the string is 59298. Any idea how to know what is the size of this string? I am trying to figure out if I am exceeding the size of the string. The error I get is the following
    ORA-06512: at "SYS.DBMS_LOB", line 789
    ORA-06512: at line 1
    Second exception: ORA-21560: argument 2 is null, invalid, or out of range
    ORA-06512: at "SYS.DBMS_LOB", line 789
    Thanks
    Ray

    Either your stacktrace is incomplete or you make something wrong by copy/paste. And please, by providing sql/plsql code, use the tags [ code ] [ / code ] or [ pre ] [ / pre ], otherwise it is very hard to read.
    Here is small demonstration of what i mean by 3rd parameter:
    SQL> CREATE TABLE T_LOB(ID NUMBER,MESSAGE CLOB)
      2  /
    Table created.
    SQL> DECLARE
      2  l_clob CLOB;
      3  BEGIN
      4  INSERT INTO t_lob VALUES(1,'Hello')
      5  RETURNING message INTO l_clob;
      6  dbms_lob.writeappend(l_clob,length(',world'));
      7  END;
      8  /
    dbms_lob.writeappend(l_clob,length(',world'));
    ERROR at line 6:
    ORA-06550: line 6, column 1:
    PLS-00306: wrong number or types of arguments in call to 'WRITEAPPEND'
    ORA-06550: line 6, column 1:
    PL/SQL: Statement ignored
    SQL> DECLARE
      2  l_clob CLOB;
      3  BEGIN
      4  INSERT INTO t_lob VALUES(1,'Hello')
      5  RETURNING message INTO l_clob;
      6  dbms_lob.writeappend(l_clob,length(',world'),',world');
      7  END;
      8  /
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM t_lob
      2  /
            ID MESSAGE
             1 Hello,worldIn your examples, after length('some lengthy string...' there is no more parameters to dbms_lob.writeappend ( or i don't see any).
    Best regards
    Maxim

  • How to find a substring in XML-lookslike string?

    Hi,
    I have a question and wondering if anyone can help me with it.
    We have Java tool that does a string replacement inside another string (that is actually an XML request). It works fine when searching for a simple substring (that exists within 1 line of the XML string).
    But when I'm trying to find and replace a substring that covers more then 1 line of XML request - it does not work. And I'm not sure what is wrong or (more importantly) how to make it work.
    There is no return or new-line chars seen in the XML request.
    To make it more clear - here is what I have and trying to do:
    <a>
    <a>
    <b>
    <c>
    <d> </d>
    <c>
    <c>
    </c>
    </c>
    </c>
    </b>
    </a>
    </a>
    If I'll seach for either <c> OR </c> OR <d> </d> it all works fine ... BUT if Itry to find
    </c>
    </b>
    which will be copied directly from the XML request and past into field - thus it will look like this (horisontal line instead of vertical) </c> </b> - it does not work

    qavlad wrote:
    But when I'm trying to find and replace a substring that covers more then 1 line of XML request - it does not work. First statement - "more than 1 line"
    There is no return or new-line chars seen in the XML request.Second statement.
    There is no way that I can understand what you meant in your first statement in terms of your second.
    If there are no end of line characters at all then there is only one line. Period.
    If there are end of line characters, of any kind, then that would really suggest the source of the problem.

  • Finding characters in a line

    Hi,
    Can any body give me an idea on how to find out wether the given sequence of characters are there or not in a line of text.
    Thanks in advance

    Also String.contains()
    Both allow some -but different - flexibility in how they are used.

Maybe you are looking for