PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Deleting the last element
  • Various
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Deletes an element at a given position:
  • from a one-dimensional WLanguage array.
  • from an advanced array property (array of gglCalendar events, ...).
  • from an associative array.
  • from a WLanguage list.
The size of the array is automatically reduced.
Notes:
  • This function is equivalent to ArrayDelete.
  • WEBDEV - Browser codePHP This function can only be used with the Array and Associative Array variables.
Versions 16 and later
Java This function is now available for the Java applications.
PHP This function is now available for the PHP sites.
Android This function is now available for the Android applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
New in version 16
Java This function is now available for the Java applications.
PHP This function is now available for the PHP sites.
Android This function is now available for the Android applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Java This function is now available for the Java applications.
PHP This function is now available for the PHP sites.
Android This function is now available for the Android applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Apple Watch This function is now available in Apple Watch mode.
WEBDEV - Browser code This function is now available in browser code.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
AndroidAndroid Widget Java This function is now available for the List variables.
New in version 21
Apple Watch This function is now available in Apple Watch mode.
WEBDEV - Browser code This function is now available in browser code.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
AndroidAndroid Widget Java This function is now available for the List variables.
Apple Watch This function is now available in Apple Watch mode.
WEBDEV - Browser code This function is now available in browser code.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
AndroidAndroid Widget Java This function is now available for the List variables.
Example
MyArray is array of 2 strings
MyArray[1] = "WINDEV"
MyArray[2] = "WEBDEV"
// Delete the 1st element
Delete(MyArray, 1) // Deletes "WINDEV"
// Display the 1st element
Trace(MyArray[1])  // Displays "WEBDEV"
// Associative array Last Name - First Name
aaLastNameFirstName is associative array of strings
Insert(aaLastNameFirstName, "Smith", "Tommy")
Insert(aaLastNameFirstName, "Montgomery", "Julia")
Delete(aaLastNameFirstName, "Smith")
// Deletion during a browse
sLastName is string
sFirstName is string
FOR EACH ELEMENT sFirstName, sLastName OF aaLastNameFirstName
Trace(sFirstName + ":" + sLastName)
Delete(aaLastNameFirstName, CurrentElement)
END
Syntax

Deleting an element from a WLanguage array or from an advanced array property Hide the details

<Result> = Delete(<Array Name> , <Element Subscript>)
<Result>: Integer
Number of deleted elements (always corresponds to 1).
<Array Name>: Array
Name of Array variable to use. This array must be a one-dimensional array.
<Element Subscript>: Integer
  • Subscript of element to delete. A WLanguage error occurs if this parameter is greater than the number of array elements.
  • Versions 17 and later
    The following constants can be used:
    FirstElementThe first array element is deleted.
    LastElementThe last array element is deleted.
    CurrentElementThe current element is deleted. This constant is used to delete the current element during a FOR EACH browse.
    This constant is only available for associative arrays.
    New in version 17
    The following constants can be used:
    FirstElementThe first array element is deleted.
    LastElementThe last array element is deleted.
    CurrentElementThe current element is deleted. This constant is used to delete the current element during a FOR EACH browse.
    This constant is only available for associative arrays.
    The following constants can be used:
    FirstElementThe first array element is deleted.
    LastElementThe last array element is deleted.
    CurrentElementThe current element is deleted. This constant is used to delete the current element during a FOR EACH browse.
    This constant is only available for associative arrays.

Deleting an element from an associative array Hide the details

<Result> = Delete(<Array Name> , <Element Key>)
<Result>: Integer
Number of deleted elements:
  • 1 or 0 for the associative arrays without duplicates.
  • 0 to N for the associative arrays with duplicates.
<Array Name>: Associative array
Name of Associative Array variable to use.
<Element Key>: Integer
  • Value of key corresponding to the element to delete.
    • In an associative array without duplicate: If the element exists, it is deleted ; if the element does not exist, no operation is performed.
    • In an associative array with duplicates: If the element exists, all the <Element Key> elements are deleted ; if the element does not exist, no operation is performed.
  • This parameter can also correspond to the CurrentElement constant. This syntax is used to delete the current element during a FOR EACH browse.
WEBDEV - Browser codePHP Not available in browser code and in PHP

Deleting an element from a List variable Hide the details

<Result> = Delete(<List Name> , <Element Subscript>)
<Result>: Integer
Number of deleted elements (1 for the lists).
<List Name>: List
Name of List variable to use.
<Element Subscript>: Integer constant
Subscript of list where the element will be deleted. The following constants can be used:
FirstElementThe first element found in the list is deleted.
LastElementThe last element found in the list is deleted.
CurrentElementThe current element is deleted. For a list, this constant is available when browsing the list elements (during a FOR EACH browse).
Remarks

Deleting the last element

If the last element is deleted, the array is resized to 0. The array is not freed: new additions can be performed without re-allocating the array.

Various

This function cannot be used with the fixed arrays.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230vm.dll
Windows Mobile wp230vm.dll
WEBDEV - Browser code WDJS.DLL
Java wd230java.jar
Linux wd230vm.so
Android wd230android.jar
Minimum required version
  • Version 14
This page is also available for…
Comments
Exemplo Delete
// Exemplo Delete
tabListanumeros is array of 0 int
ArrayAddLine(tabListanumeros,10)
ArrayAddLine(tabListanumeros,5)
ArrayAddLine(tabListanumeros,3)
ArrayAddLine(tabListanumeros,1)
EDT_Texto = ArrayToString(tabListanumeros)

//Eliminar uma linha

Delete(tabListanumeros,EDT_LinhaEliminar)

EDT_resultado = ArrayToString(tabListanumeros)

http://windevdesenvolvimento.blogspot.com.br/2016/12/aula-995-windev-array-007-delete.html

https://www.youtube.com/watch?v=n_mMH9khOr4
De matos
Dec. 13 2016