@sstrbl() Function

Top  Previous  Next

@sstrbl() function ("Substring Before Last") extracts the substring existing in a string before the last occurrence of the reference substring and returns it.

Syntax:

@sstrbl(string-expressionreference-substring-expression[, default-substring-expression])

 

string-expression

The string to extract a substring from

reference-substring-expression

The reference substring to searched. The substring to be extracted ends right before the last occurrence of this substring in string-expression.

default-substring-expression

This optional parameter defines the substring to return in case of the reference substring is not found.

 

Examples:

@sstrbl('aaa bbb ccc',' ') @// result: 'aaa bbb'

@sstrbl('123.45','.')      @// result: '123'

 

@set(v:full_file_name, 'c:\aaa\bbb\ccc.txt')

@set(v:folder_name, sstrbl(v:full_file_name,'\','') )   @// returns: 'c:\aaa\bbb'

 

See @sstr(), @rsstr(), @sstra(), @sstral(), @sstrb(), @sstrbl()