|
Posted by ZeldorBlat on 11/18/05 21:22
I don't think they have a CHARINDEX that searches from the end of the
string. If you want to know the last position of a character within a
string, you can abuse the reverse() function like this:
len(filepath) - charindex('/', reverse(filepath)) + 1
That gives you the position of the last '/' in the string. Note that
this only works if you're searching for a single character (that is, it
won't work if you replace the '/' with some arbitrary string with
length > 1). Also, if there is no '/' in the string, this guy will
return len(filename) + 1 as opposed to the normal charindex() which
returns 0 if the needle isn't found.
Navigation:
[Reply to this message]
|