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.
# See also a good hint with explanation between like and contains:
# http://windowsitpro.com/blog/powershell-contains
$fullstring = "This is my string";
if ($fullstring -like "*my*")
{
Write-Host "found" -ForegroundColor Green;
}
else
{
Write-Host "nope" -ForegroundColor Red;
}
237
MySQL
Strings
String nach einem Teilstring durchsuchen
SELECT
myString
,locate('#',myString,5) AS findPosition -- Result is: 8
,left(myString,locate('#',myString,2)-1) AS ExtractedString -- Result is: abc
,left(myString,locate('#',myString,5)) AS ExtractedString -- Result is: abc#def#
FROM
(
SELECT
'abc#def#ghj' AS myString
) dummyString
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$;
37
Java
GUI, Komponenten allgemein
L&F setzen/ändern
import javax.swing.UIManager;
// Set the L&F to the standard OS-Theme
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
// there are other possibilites and L&F-Sets... Just google ;-)
// For example look at L2FProd or Substance...
36
Java
GUI, Komponenten allgemein
Panel Größe ändern
import java.awt.Dimension;
import javax.swing.JPanel;
Dimension dim = new Dimension();
dim.height=300;
dim.width=500;
JPanel pan = new JPanel();
pan.setPreferredSize(dim);
35
Java
GUI, Komponenten allgemein
Focus setzen
jTextfield1.requestFocus();
34
Caché
Caché-Spezifisch, Prozesse/Jobs
Variableninhalt eines fremden Prozesses ermitteln
; Important: You musn't check variables in your own job, it will result in a <PARAMETER>-Error!
Set checkjob=1234
Set checkvar="foo"
; Check if job is not my own
Quit:checkjob=$Job
; Check if Job exists und prompt the content of the varible foo
If $Data(^$Job(checkjob)) W !,$ZUtil(88,2,checkjob,checkvar)
; Prompts the content of the variable foo, maybe it is 'bar' ;-)
31
PHP
Strings
String nach Delimenter zerlegen
$myString = "A;B;C;D;E";
$myPieces = explode(";",$myString); // erzeigt ein Array mit den einzelnen Zeichen
echo $myPieces[2]; // gibt C aus
32
Java
Strings
String nach Delimenter zerlegen
String myString = new String;
String[] myPieces = new String;
myString = "A;B;C;D;E";
myPieces = myString.split(";"); // erzeugt ein Arrey mit den einzelnen Zeichen
System.out.println(myPieces[2]); // gibt C aus