atnext( ) Function

Description:
  The atNext() function returns the offset within cDest of the nOccur occurrence of cSearch. If cSearch is not found, -1 is returned. The comparison is case sensitive. For a case insensitive search, see the atnexti() function.  

Syntax:
  retval = atnext( cSearch, cDest, nOccur )

Parameters:
  string: cSearch String to search for.
  string: cDest String to search in.
  numeric: nOccur Occurrence of string cSearch to look for.
  numeric: retval The offset in cDest of the occurrence nOccur of cSearch or -1 if not found.

Platforms:
  Windows, DOS, Internet Active Pages



Example:

	local var1, var2, var3, retval                   	// Variables
	var1 = ( "123456789012345678901234567890")		// Search String
	var2 = prompt( "Pick a number from 1 to 10", "", 2 )	// Number to search for
	var3 = prompt( "Pick a number from 1 to 3", "", 2 )	// Occurance
	retval = atnext( var2, var1, var3 ) 
	
	retval = retval + 1					// Start count from 1 instead of 0
	println( "In this String (" + var1 + ") " )
	println( "You picked the Number (" + var2 + ")" )
	println( "And the " + var3 + " occurance of it" )
	println( "Which means you picked the " + retval + " character in the string." )

  

(c) 2000-2001 by West Coast Web Adventures, Inc., All Rights Reserved