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

Similar Messages

  • 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();

  • Find no numbers  characters in a string

    HI, how i can find no numbers characters in a string
    By example.
    '45125454564#4545'.
    I only want to know if the string contains no number characters or not, i dont want to know the character '#'.
    Is there a function module for doing that?
    Thanks

    You can try:
    NUMERIC_CHECK
    OR
    IF var CO '0123456789'.
    ENDIF.

  • [Forum FAQ] How to find and replace text strings in the shapes in Excel using Windows PowerShell

    Windows PowerShell is a powerful command tool and we can use it for management and operations. In this article we introduce the detailed steps to use Windows PowerShell to find and replace test string in the
    shapes in Excel Object.
    Since the Excel.Application
    is available for representing the entire Microsoft Excel application, we can invoke the relevant Properties and Methods to help us to
    interact with Excel document.
    The figure below is an excel file:
    Figure 1.
    You can use the PowerShell script below to list the text in the shapes and replace the text string to “text”:
    $text = “text1”,”text2”,”text3”,”text3”
    $Excel 
    = New-Object -ComObject Excel.Application
    $Excel.visible = $true
    $Workbook 
    = $Excel.workbooks.open("d:\shape.xlsx")      
    #Open the excel file
    $Worksheet 
    = $Workbook.Worksheets.Item("shapes")       
    #Open the worksheet named "shapes"
    $shape = $Worksheet.Shapes      
    # Get all the shapes
    $i=0      
    # This number is used to replace the text in sequence as the variable “$text”
    Foreach ($sh in $shape){
    $sh.TextFrame.Characters().text  
    # Get the textbox in the shape
    $sh.TextFrame.Characters().text = 
    $text[$i++]       
    #Change the value of the textbox in the shape one by one
    $WorkBook.Save()              
    #Save workbook in excel
    $WorkBook.Close()             
    #Close workbook in excel
    [void]$excel.quit()           
    #Quit Excel
    Before invoking the methods and properties, we can use the cmdlet “Get-Member” to list the available methods.
    Besides, we can also find the documents about these methods and properties in MSDN:
    Workbook.Worksheets Property (Excel):
    http://msdn.microsoft.com/en-us/library/office/ff835542(v=office.15).aspx
    Worksheet.Shapes Property:
    http://msdn.microsoft.com/en-us/library/office/ff821817(v=office.15).aspx
    Shape.TextFrame Property:
    http://msdn.microsoft.com/en-us/library/office/ff839162(v=office.15).aspx
    TextFrame.Characters Method (Excel):
    http://msdn.microsoft.com/en-us/library/office/ff195027(v=office.15).aspx
    Characters.Text Property (Excel):
    http://msdn.microsoft.com/en-us/library/office/ff838596(v=office.15).aspx
    After running the script above, we can see the changes in the figure below:
    Figure 2.
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thank you for the information, but does this thread really need to be stuck to the top of the forum?
    If there must be a sticky, I'd rather see a link to a page on the wiki that has links to all of these ForumFAQ posts.
    EDIT: I see this is no longer stuck to the top of the forum, thank you.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • How do I drop the last 3 characters in a string?

    Hello.  I'm trying to find a way to drop the last 3 characters in a string.  The length varies because it is a last name field.  The problem is that when a customer has a suffix on their name, III for example, it is appended to the last name all in the last name field.  If I use the ProperCase function, I end up with "Smith Iii".  How can I tell it to drop the last 3 characters?  I'll then append an UpperCase edition of the last 3 characters to that.  Thank you!

    Use the instring and right string functions then UpperCase

  • Scanning values of characters in a string

    Hey guys,
    I'm trying to figure out a way I can scan the individual characters of a string to find their value [unicode value, if it's a number, punctuation etc] and I'm a bit stumped. I know I'll have to be using the chatAt method, but I can't think of how I could implement this to continuiously scan through a string.
    If someone could help point me in the right direction it would be great.
    Thanks in advance.

    Do you know what a loop is?
    http://java.sun.com/docs/books/tutorial/java/nutsandbolts/index.html
    Do you know how to find out about methods of the String class such as toCharArray?
    http://java.sun.com/javase/6/docs/api/java/lang/String.html

  • Count of characters in a string

    Hi all,
    Is there any way to find the repeating characters in the string like 'L' in the example Hello ..
    Thanks in advance,
    Nalla !
    Message was edited by: Nalla
    Nalla (Nallasivam)

    test@ORA10G>
    test@ORA10G> with t as (
      2    select 'hello' as str from dual union all
      3    select 'abracadabra' from dual union all
      4    select 'the quick brown fox jumps over the lazy dog' from dual union all
      5    select 'abcdefghijklmnopqrstuvwxyz' from dual union all
      6    select 'facetious' from dual)
      7  --
      8  select
      9    str
    10  from t
    11  where (
    12    length(str) - length(replace(lower(str),'a')) > 1 or
    13    length(str) - length(replace(lower(str),'b')) > 1 or
    14    length(str) - length(replace(lower(str),'c')) > 1 or
    15    length(str) - length(replace(lower(str),'d')) > 1 or
    16    length(str) - length(replace(lower(str),'e')) > 1 or
    17    length(str) - length(replace(lower(str),'f')) > 1 or
    18    length(str) - length(replace(lower(str),'g')) > 1 or
    19    length(str) - length(replace(lower(str),'h')) > 1 or
    20    length(str) - length(replace(lower(str),'i')) > 1 or
    21    length(str) - length(replace(lower(str),'j')) > 1 or
    22    length(str) - length(replace(lower(str),'k')) > 1 or
    23    length(str) - length(replace(lower(str),'l')) > 1 or
    24    length(str) - length(replace(lower(str),'m')) > 1 or
    25    length(str) - length(replace(lower(str),'n')) > 1 or
    26    length(str) - length(replace(lower(str),'o')) > 1 or
    27    length(str) - length(replace(lower(str),'p')) > 1 or
    28    length(str) - length(replace(lower(str),'q')) > 1 or
    29    length(str) - length(replace(lower(str),'r')) > 1 or
    30    length(str) - length(replace(lower(str),'s')) > 1 or
    31    length(str) - length(replace(lower(str),'t')) > 1 or
    32    length(str) - length(replace(lower(str),'u')) > 1 or
    33    length(str) - length(replace(lower(str),'v')) > 1 or
    34    length(str) - length(replace(lower(str),'w')) > 1 or
    35    length(str) - length(replace(lower(str),'x')) > 1 or
    36    length(str) - length(replace(lower(str),'y')) > 1 or
    37    length(str) - length(replace(lower(str),'z')) > 1
    38  );
    STR
    hello
    abracadabra
    the quick brown fox jumps over the lazy dog
    3 rows selected.
    test@ORA10G>
    test@ORA10G>pratz

  • Replace multiple characters in a string

    Hi, I have some string fields that contain special characters such as ô and û and I want to replace them with ō and ū, and their upper case equivalents as well. How do I write a single formula that would find any of these characters in a string and replace them?
    Thanks,
    Will

    replace(replace(replace(replace(x,'ô','ō'),'û','ū'),'Ô','Ö'),'Û','Ü');
    where x is the string field.  I suggest using the unicodes rather than the actual character.  I do not think that I have the correct uppercase characters.  Please ensure that they are correct in your formula.

  • Number of characters in a string

    Hi,
    I need to find the number of characters in a string. For instance, i have a string type variable with the value "ABAP". How can i know how many letters "A" there are in that string? Is there any FM that does this?
    Cheers,
    Roberto

    Hi,
    you can make use of string operation FIND as:
    DATA: text1 TYPE string VALUE `A`,
             text TYPE string,
          off  TYPE i,
          moff TYPE i,
          mlen TYPE i.
    off = 0.
    WHILE sy-subrc = 0.
      FIND text1 IN SECTION OFFSET off OF
           `ABAP`
           MATCH OFFSET moff
           MATCH LENGTH mlen.
      IF sy-subrc = 0.
        WRITE / moff.
        off = moff + mlen.
      ENDIF.
    ENDWHILE.

  • 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

    And now a working version:
        public boolean hasRepeatedChars (String word) {
            boolean found = false;
            int i = 0;
            char lastChar = '\0';
            while ((i != word.length ()) && ! found) {
                char c = word.charAt (i);
                found = ((i != 0) && (c == lastChar));
                lastChar = c;
                i ++;
            return found;
        }

  • Is there a function to check a list of characters in a string?

    is there a function to check a list of characters in a string?

    You need to create a vi. Find attached a vi that you can use. In the vi, if the number of match occurrence is zero, that indicates no match otherwise it will return the number of matches in the supply string. The vi is a modified version of Search String and Replace - General
    Attachments:
    Search_String_and_Count_Match.vi ‏17 KB

  • Finding first numeric in string

    Hi,
    I am trying to find a way I can find the first numeric in a string.
    This works but I have to do it 10 times:
    String vtemp = vdoc.indexOf('1');Example of data:
    AB123
    CDE456
    ABCD789I am trying to find a way to do something like: indexOf(any number); So I can get the result in one line of code.
    Thanks for any help

    Hi GaryJSF,
    You have to convert your string into an array of characters and for each character, check if it's a digit until you find the first one :
    String str = "ABC123";
    char[] crs = str.toCharArray();
    for (int i = 0; i < crs.length; i++) {
        if (Character(crs).isDigit()) {
    System.out.println("first index = " + i);
    break;

  • Query engine : Can not find DSN in Connection String

    DearSir/Madam,
    Opearating System Windows 7 Professional(32-bit).
    I am using Application, which is developed : Visual basic 6.0(32-bit), Report Writer : Crystal Report 9.2.693(32-bit) and database: Oracle 9.2.0.10(32-bit).
    ODBC Data source : System DSN created and Connection established (Based on Driver : CR ORACLE ODBC Driver 4.10 (cror818.dll))
    In windows 7 environment Data Base connectivity and data fetching also wroking fine.
    My problem is while running reports it display error as "Query engine : Can not find DSN in Connection String"
    I want run time reports.
    For your kind information, at the same time in Windows XP Professional there is no problem found and working fine.
    Kindly help me.
    Thanks and regards,
    Swarup

    Crystal Reports 9.x is not supported on Win 7. See the following wiki:
    http://wiki.sdn.sap.com/wiki/x/b4JiAw
    - Ludek

  • Find and Replace text string in HTML

    Opps... I hope this forum is not just for Outlook. My Html files reside on my hard-drive. I am looking for VBA code to open specified file names ####File.html and then find and replace text strings within the html for example "####Name" replaced
    with "YYYYY"
    I drive the "####File.html" names and the find and replace text strings from an Excel sheet. I am an artist and this Sub would give me time to paint instead of find and replace text. Thank you!
    [email protected]

    Hello Phil,
    The current forum is for developers and Outlook related programming questions. That's why I'd suggest hiring anybody for developing the code for you. You may find freelancers, for example. Try googling for any freelance-related web sites and asking such
    questions there.
    If you decide to develop an Outlook macro on your own, the
    Getting Started with VBA in Outlook 2010 article is a good place to start from.

  • How to count number of repeated characters in a String

    I have a String.... 10022002202222.
    I need to know how many 2's are there in the string... here the string contains eight 2's..
    Thanks in advance..

    it is workingYes, but... attention to surprises...
    SQL> var v1 varchar2(1000);
    SQL> exec :v1 := 'How to count the number of occurences of a characters in a string';
    PL/SQL procedure successfully completed.
    SQL> select length(:v1) - length(replace(:v1,'c')) from dual;
    LENGTH(:V1)-LENGTH(REPLACE(:V1,'C'))
                                       6
    SQL> exec :v1 := 'cccccc';
    PL/SQL procedure successfully completed.
    SQL> select length(:v1) - length(replace(:v1,'c')) from dual;
    LENGTH(:V1)-LENGTH(REPLACE(:V1,'C'))
    SQL> select length(:v1) - nvl(length(replace(:v1,'c')),0) from dual;
    LENGTH(:V1)-NVL(LENGTH(REPLACE(:V1,'C')),0)
                                              6
    SQL>

Maybe you are looking for

  • Can we open and close Posting period for HR module

    Dear All , Can someone please tell me is there any option available to open and close Posting period for HR Module.We have In Finance and MM. Cheers Balaji Dhanavel

  • Acrobat XI Pro isn't available

    I don't reach to use my new Acrobat XI Pro. Because I can't confirm my serial number. The product isn't on the list!!???

  • How to display only contact containing a number when accessing from phone

    Many of the contact in the address book, contain e-mail only data. These are very useful for mail but are distracting when you launch the address book to call someone. Is there a way to show only names that actually have a phone number, when you open

  • Event handling for UIImageView inside UIScrollView

    Hi, I have a UIScrollVIew. I added a UIImageView inside it. I found that UIImageView did not reveive any events. No matter what I do, there is only image zoom in out and flip. How can I enable UIImageVew to receive some events? Thanks, fm

  • In Task AutoAssignment no LOV found in Default Tasks

    Hi, In Project Manafacturing N:Project Parameters->Project->Tab->Task AutoAssignment->In Default Task no LOV found in Material, Resource & WIP Material. Project is already defined. Can anybody help me for the solution. Thanks Regards GSM