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.
import commands
output=commands.getoutput("dir")
print output
# home tmp myFile.sh
43
Bash Script
Sonstiges
Kopfzeile sh-Datei
#!/bin/sh
# Einfaches Beispiel ...
42
PHP
HTTP Form Submit
POST Werte abfragen
if ($_POST["submitName"]=="submitValue")
{
echo "Button submitValue gedrückt";
}
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!!
}
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;
133
VB.NET
Strings
String nach einem Teilstring durchsuchen
Dim longStr = "This is a long string"
Dim searchFor = "long"
position = InStr( longStr, searchFor )
138
T-SQL
Datenbank
String nach einem Teilstring durchsuchen
-- Find characters which are also special characters for search terms, e.g. % or _
-- see also: http://msdn.microsoft.com/en-us/library/ms179859%28v=sql.105%29.aspx
SELECT * FROM table_1 WHERE column_1 LIKE '%!_%' ESCAPE '!'
-- Find results which includes the character "_". The escape character is defined as "!"
161
Python
Strings
String nach einem Teilstring durchsuchen
# http://www.tutorialspoint.com/python/string_find.htm
# this function is case sensitive
fullstring = "This is my string"
searchFor = "my"
startPosition = fullstring.find(searchFor, 0, len(fullstring))
# startPosition will have 8
if startPosition>=0:
print "I found it!"
startPosition = fullstring.upper().find(searchFor.upper()) # case insensitive