Home | About SQeeL | Document | DownLoad | Mail Japanese
Home > Document > SQeeL Reference
A B C D E F G H I J L M N O P R S T U X Y  

I

  • Built-in function
  • instr()
    Description
    Starts searching STRING2 from the Nth letter in STRING. It returns the position of the Mth occurrence of SEARCH_STRING in STRING.
    If the length of SEARCH_STRING is longer than 1, it returns the location of the first letter.
    If N is negative, it start searching from the end of STRING. The value of M must be pisitive.
    The default of both N and M is 1. This starts searching SEARCH_STRING from the beginning of STRING. It returns the position of the first occurrence of SEARCH_STRING in STRING.
    The return value is the exact position from the beginning of the letters, regardless of the value of N.
    If the search fails (e.x. there are not M occurrences of SEARCH_STRING in STRING after Nth letter), the return value is 0.
    Syntax
    ret = instr(string1,search_string,n,m)
    Parameters
    string1:Character string to be searched
    search_string:Search string
    n:Location to start searching
    Default: 1
    m:Number of strings to be searched
    Default: 1
    Return Value
    integral number:Location found
    0:Search fails
    System Return Value
    ERROR
    0Success
    1Argument error
    Example
    //[result example]
    // 1:6
    // 2:13
    //
    
    run()
    exit
    
    function run()
    	local a = 'data1;.data2;.data3;.data4'
    	print(instr(a, ';.', 1, 1))
    	print(instr(a, ';.', -8, 1))
    endfunction
    
    
    Top‚Ö

    © Insight Technology, Inc. 1996-2003 All Rights Reserved.