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  

U

  • Built-in function
  • unshift()
    Description
    Prepend the value into the front of array.
    New element will be the 0th element. Number of elements in array increases by 1.
    Rest of the elements is moved up.
    If non-array variable is specified, the length of the array will be two elements of which the new element will be 0th and the original element if the 1st.
    The combination of unshift and pop will enable easy implementation of FIFO queue. .
    Syntax
    ret = unshift(array,value)
    Parameters
    array:Array to unshift an element
    value:Element to be added
    Example
    //[result example]
    //
    // --------------------------------
    // [ sample1 ]
    //
    // a_array[0] => elem1
    // a_array[1] => elem2
    // a_array[2] => elem3
    //
    // *** unshift(a_array, 'elem0') **
    //
    // a_array[0] => elem0
    // a_array[1] => elem1
    // a_array[2] => elem2
    // a_array[3] => elem3
    //
    //
    // [ sample2 ]
    //
    // s_str = 'aaa'
    //
    // *** unshift(s_str, 'bbb') ***
    //
    // s_str[0] => bbb
    // s_str[1] => aaa
    // --------------------------------
    //
    
    run()
    exit(0)
    
    function run()
    
    	local a_array = { 'elem1', 'elem2', 'elem3' }
    	local s_str = 'aaa'
    	local i
    
    	print("--------------------------------", stdout)
    	print("[ sample1 ]\n", stdout)
    
    	loop i=0; i<count(a_array); i++
    		print("a_array[" & i & "] => " & a_array[i], stdout)
    	endloop
    
    	print("\n*** unshift(a_array, 'elem0') ***\n", stdout)
    
    	// unshift
    	unshift(a_array, 'elem0')
    
    	loop i=0; i<count(a_array); i++
    		print("a_array[" & i & "] => " & a_array[i], stdout)
    	endloop
    	print("\n", stdout)
    
    	print("[ sample2 ]\n", stdout)
    	print("s_str = 'aaa'", stdout)
    	print("\n*** unshift(s_str, 'bbb') ***\n", stdout)
    
    	// unshift
    	unshift(s_str, 'bbb')
    
    	loop i=0; i<count(s_str); i++
    		print("s_str[" & i & "] => " & s_str[i], stdout)
    	endloop
    
    	print("--------------------------------", stdout)
    
    endfunction
    
    
    
    Top‚Ö
    upper()
    Description
    Converts character string to upper-case letters
    Syntax
    ret = upper(string)
    Parameters
    string:Character string
    Return Value
    string:Converted character string
    System Return Value
    ERROR
    0Success
    1Argument error
    Example
    //[result example]
    //
    // INSIGHT TECHNOLOGY
    //
    
    run()
    exit
    
    function run()
    	local a = 'insight technology'
    
    	print(upper(a),stdout)
    endfunction
    
    
    Top‚Ö

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