Difference between revisions of "George Functions : Find"

From TVPaintWiki
Jump to: navigation, search
(Blanked the page)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
FUNCTION Find(string,car,start)
 
  LOCAL i size
 
  i = start
 
  size = LEN(string)
 
  IF ((start <= 0) || (start > size) || (CMP(car,"") == 1))
 
  RETURN -1
 
  END
 
  DO
 
  IF (CMP(CHAR(string,i),car) == 1)
 
    RETURN i
 
  END
 
  UNTIL ((i=i+1) > size)
 
  RETURN 0
 
END
 
  
 
==Description==
 
Find
 
 
Function: find a character into a string from a specified start position
 
 
Call: Find(string,car,start)
 
 
Arguments:
 
* string = characters string
 
* car    = character to look for
 
* start  = start position in string
 
 
Return: position of character
 
 
0 if character does not exist into string
 
-1 if invalid position (negative, null or higher)
 

Latest revision as of 13:09, 9 January 2013