Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
christophebrock1
Contributor II
Contributor II

Find last occurence of a character in a string

Hello,

I'm looking for the best way to find the last occurrence of a character in a string.

Concrete example:

Out of this url: http://www.website.com/sub1/sub2/subx/suby/filename.jpg

I need to fetch:

"filename.jpg" as the result of the function.

The path before the filename can be different every time so I'm looking for a generic solution.

Any help would be greatly appreciated !

Kind regards,

Christophe

1 Solution

Accepted Solutions
m_woolf
Master II
Master II

Index(URL,'/',-1) will return the position of the last "/" in the string.

mid(URL,Index(URL,'/',-1)+1) will return the filename and extension

View solution in original post

3 Replies
m_woolf
Master II
Master II

Index(URL,'/',-1) will return the position of the last "/" in the string.

mid(URL,Index(URL,'/',-1)+1) will return the filename and extension

cspencer3
Creator II
Creator II

You could also do this:

=SubField(URL,'/',SubStringCount(URL, '/')+1)

URL being the field that has the URL in it

Amit
Contributor III
Contributor III

Perfect answer!