You may optionally enter a comparison operator (<, <=, >, >=, <> or =) at the beginning of each of your search values to specify how the comparison should be done.
@echo off
SET myVariable=This is my content
SET myPathVariableWithBlanks="C:\Temp\Path With Blanks\File.txt"
echo %myVariable%
REM This is my content
echo %myPathVariableWithBlanks%
REM "C:\Temp\Path With Blanks\File.txt"
183
Batch
Variablen
Wert einer Variable zuweisen
@echo off
cd C:\Temp
REM Aktuelles Verzeichnis in einer Variable setzen
SET mydir="Mein Verzeichnis lautet %CD%"
echo %mydir%
REM "Mein Verzeichnis lautet C:\Temp"
266
MS Access VBA
Array
Dictionary Basics
' empty dict
Dim myDict As Dictionary
Set myDict = New Dictionary
' some static values
myDict.Add "key1", "value1"
myDict.Add "key2", "valueY"
myDict.Add "keyX", "value98"
' update a key programmatically
myDict.Remove "key1"
myDict.Add "key1", "new value"
' iterate
Dim strKey As Variant
Dim current_key As String
Dim strValue As String
For Each strKey In myDict.Keys()
current_key = strKey
strValue = myDict.Keys(strKey)
Next
' Exists
If myDict.Exists(strKey) Then
Debug.Print "yes"
End If
' get an specific item
Dim subdict As String
subdict = myDict.Keys("key2")
# valueY
267
PowerShell
Array
Dictionary Basics
# empty Hashtable
$myDict = @{}
# some static values
$myDict.Add("key1", "value1")
$myDict.Add("key2", "valueY")
$myDict.Add("keyX", "value98")
# update a key programmatically
$myDict.Remove("key1")
$myDict.Add("key1", "new value")
# iterate
Foreach ($key in $myDict.keys) {
$strKey = $key
$strValue = $Parameter[$key]
}
# Exists
If ($myDict.ContainsKey("key1") -eq $true) {
write-host "yes"
}
# get an specific item
$subdict = $myDict("key2")
# valueY
S arr("dim1","dim2")="value"
Set arr("dim1",99)=187
; Persistent, will be saved with prefix ^:
S ^save("dim1","dim2")="saved value"
29
Java
Array
Array definieren
String[] ar = new String[] {"Satz1", "Satz2"};
38
PHP
Array
Über alle Array-Elemente interieren
$arr = array(1, 2, 3, 4);
foreach ($arr as &$value) {
$value = $value * 2;
}
// $arr is now array(2, 4, 6, 8)
foreach ($arr as $key => $value) {
echo "{$key} => {$value} ";
}
301
PL/pgSQL
Array
Über alle Array-Elemente interieren
DO
$do$
DECLARE
m text[];
arr text[] := '{{key1,val1},{key2,val2}}'; -- array literal
BEGIN
FOREACH m SLICE 1 IN ARRAY arr
LOOP
RAISE NOTICE 'another_func(%,%)', m[1], m[2];
END LOOP;
END
$do$;
-- ---------------------------------------------------------
DO
$do$
DECLARE
i text;
arr text[] := '{key1,key2}'; -- array literal
BEGIN
FOREACH i IN ARRAY arr
LOOP
RAISE NOTICE 'another_func(%)', i;
END LOOP;
END
$do$;
62
VB.NET
Array
Array definieren
Dim myStrArray(3) As String
myStrArray(0)="First"
myStrArray(1)="Second"
myStrArray(2)="Third"
myStrArray(3)="Fourth"
ReDim strJahreszeiten(4)
myStrArray(4)="Fifth"
Dim my2DimStrArray(1,2) As String
my2DimStrArray(0,0) = "This"
my2DimStrArray(0,1) = "is"
my2DimStrArray(0,2) = "a"
my2DimStrArray(1,0) = "2"
my2DimStrArray(1,1) = "dimensional"
my2DimStrArray(1,2) = "matrix"