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.
-- http://www.postgresql.org/docs/9.1/static/functions-datetime.html
select extract(month from now())
120
PL/pgSQL
Strings
String in Dezimal konvertieren
-- Da im Deutschen das Trennzeichen für eine
-- Dezimalstelle ein Komma ist, muss dieses erst
-- gegen einen Punkt ersetzt werden
select cast(replace(cast('12.12' as varchar(10)),',','.') as numeric(12,2))
119
T-SQL
Strings
Vorkommnisse eines Zeichen in einem String ermitteln
-- http://msdn.microsoft.com/de-de/library/ms181765.aspx
USE AdventureWorks2008R2;
GO
SELECT ProductNumber, Category =
CASE ProductLine
WHEN 'R' THEN 'Road'
WHEN 'M' THEN 'Mountain'
WHEN 'T' THEN 'Touring'
WHEN 'S' THEN 'Other sale items'
ELSE 'Not for sale'
END,
Name
FROM Production.Product
ORDER BY ProductNumber;
GO
117
T-SQL
Datenbank
CSV erstellen
SELECT SUBSTRING(
(SELECT ',' + CSVItem
FROM TableWithItems s
ORDER BY s.Name
FOR XML PATH('')),2,200000)
GO
116
Delphi
Strings
String nach einem Teilstring durchsuchen
searchFor:='this';
text:='this is a simple text';
if pos(searchFor,text)>0 then
begin
ShowMessage('found');
end;
public void fillSpn()
{
String dummyarr[];
Spinner spn1 = (Spinner) findViewById(R.id.spn1);
// Dummy Data
dummyarr = new String[5];
int i;
for (i=0;i<5;i++)
{
dummyarr[i]=String.valueOf(i);
}
ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, dummyarr);
spn1.setAdapter(adapter);
}
113
Android
GUI, Dialoge
Abfrage-Dialog
// siehe auch : http://developer.android.com/guide/topics/ui/dialogs.html
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure you want to exit?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
WhatHaveYouDoneActivity.this.finish();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();