[Contents] · [Home] · [Mail]

SALIERI Language - posNext

Type:
posNext: string x string x integer -> integer
posNext: list x list x integer -> integer
posNext: sequence x sequence x integer -> integer
posNext: string x string -> integer
posNext: list x list x integer -> integer
posNext: sequence x sequence x integer -> integer

Call syntax:
posNext(s_1, s_2, int)
posNext(s_1, s_2)

Description:
posNext returns the position where series s_2 occurs next in s_2, with the search starting from position int to the right; if there is no such occurrence, the value 0 is returned. The index positions within serial objects are counted 1,2,...,length(s).

The start position int can be ommitted - then the search starts from the beginning of s_1 as a default.

The start position int_1 can be a negative value, in which case it is counted from the end of the series (with index position -1 corresponding to length(s)). However, the search proceeds always from the specified start position to the right.

Error conditions:
When called with an invalid index position int, posNext returns 0 without causing an error condition to occur.

Example:
> piece := "piano concerto B major";
> posNext(piece,"o")
Result= 5
> posNext(piece,"to")
Result= 13
> posNext(piece,"o",15)
Result= 21
> posNext(piece,"oboe",1)
Result= 0
> posNext(piece,"piano",-#piece)
Result= 1
> posNext(piece,"oboe",#piece+1)
Result= 0

See also: string (object type), list (object type), sequence (object type), length.


[Contents] · [Home] · [Mail]
© sic!systems, page frame designed by hh; this page has been automatically generated from the SALIERI Documentation Database.