FIND()

FIND(S,N,P)

FINDS THE STRING S IN THE SYSTEM OBJECT NUMBER N, FROM THE POSITION P, AND RETURNS THE POSITION OF THE LAST CHARACTER OF THE FOUND STRING

  • Type: Function
  • Parameters: 3
  • Group: Strings

ACTION

The function FIND((S$,N,P) finds and selects the string S$ in the source of system object number N, from the position P, and returns the position of the last character of the found string, or -1 if string S$ is not found.

So, it is easy to find all the occurences of a sting in a source, by calling the function FIND with the position P from a previous call.

The system object is of type : MEMO, MEMO_RICH, SYNEDIT.

SYNTAX: Result=FIND(S,N,P)

  • S = string expression.
  • N = real or integer expression.
  • P = real or integer expression.

USE

  • The function FIND() is used to find a string in an object.

ERROR

  • If number N is not a correct expression.
  • If number N exceeds the allowed maximum number of system objects.
  • If number N is less than 0.
  • If the system object number N does not exist.
  • If the object number N is not of type : MEMO, MEMO_RICH, SYNEDIT.
  • If S is not a correct string expression.
  • If P is not a correct arithmetic expression.

EXAMPLE

rem create a SYNEDIT

dim pos

synedit 1:height 1,280

item_add 1,"dim a"

item_add 1,"a=12345"

wait 1000

rem find 34 and return position of last character

pos=find("34",1,pos)

caption 0,"position of last character="+str$(pos)

SEE ALSO

MEMO

MEMO_RICH

SYNEDIT

REPLACE()