DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: finding the character in a string ???

Hybrid View

  1. #1
    Join Date
    Jan 2001
    Posts
    318
    I have a string:
    c:\temp\sak\mat.exe
    I am trying to get the following string:
    mat.exe

    In short anything after the last \.
    Is there any way to get this as there are no left or right functions ( atleast I did not find them)
    The length of string is not fixed and also the .extension, path.

    Any help please
    Thanks
    Sonali

    Sonali

  2. #2
    Join Date
    Feb 2000
    Location
    Washington DC
    Posts
    1,843
    How about using substring counting the no. of characters from left and pick last characters (mat.exe). Just see the syntax. you might be interested in.

  3. #3
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    INSTR function can be used to find a n-th occurence of a particular character either forwards if n is positive or *backwards* if n is negative.

    In your example, you would use something like this:

    SELECT SUBSTR( 'c:\temp\sak\mat.exe', INSTR('c:\temp\sak\mat.exe', '\', -1)+1)) FROM dual;

    HTH,
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  4. #4
    Join Date
    Jan 2001
    Posts
    318

    Thumbs up

    Looks like JModic has answers to all/any questions.
    Not to say I tried all this but did not know -ve and +ve
    use in Instr.

    Thanks again
    Sonali
    Sonali

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width