%sstrb() Function

Top  Previous  Next

%sstrb() function ("Substring Before") extracts the substring existing in a string before the reference substring and returns it.

Syntax:

%sstrb(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 this substring.

default-substring-expression

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

 

Examples:

%sstrb('aaa bbb ccc',' ') %// result: 'aaa'

%sstrb('123.45','.')      %// result: '123'

 

%set(x, 'xyz')

%set(prefix, sstra(x,':',x) ) 

 

 

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