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.
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
33
Mumps
Strings
String nach Delimenter zerlegen
myString="A;B;C;D;E"
Write !,$Piece(myString,";",3) // gibt C aus
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' ;-)
35
Java
GUI, Komponenten allgemein
Focus setzen
jTextfield1.requestFocus();
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);
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...
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} ";
}
39
PHP
Strings
String nach einem Teilstring durchsuchen
// is case sensitiv
// use stristr for case insensitive
$email = 'name@example.com';
$domain = strstr($email, '@');
echo $domain; // Ausgabe: @example.com
$user = strstr($email, '@', true); // Ab PHP 5.3.0
echo $user; // Ausgabe: name
40
Mumps
Strings
String nach einem Teilstring durchsuchen
Set fullstring="This is my string"
Set searchfor="my"
If $Find(fullstring, searchfor) Do
. Write !,"I found it!!"
. Quit
41
Java
Strings
String nach einem Teilstring durchsuchen
String fullstring = new String("This is my string");
if (fullstring.contains("my"))
{
// I found it!!
}