Programming-Idioms

Implementation
Python

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Implementation edit is for fixing errors and enhancing with metadata.

Instead of changing the code of the snippet, consider creating another Python implementation.

Other implementations
boolean ok = s.contains(word);
var ok = s.contains(word);
$ok = index($s,$word) >= 0;
var ok = s.indexOf(word) !== -1;
import "strings"
ok := strings.Contains(s, word)
let ok = s.contains(word);
#include <string.h>
int ok=strstr(s,word)!=NULL;
$ok = strpos($s, $word) !== false;
import std.algorithm.searching;
bool ok = s.canFind(word);
ok := pos(word,s)<>0;
ok = s.include?(word)
ok = word `isInfixOf` s
ok = String.contains?(s, word)
Ok = string:str(S, Word) > 0.
ok = s:find(word, 1, true)
var ok = s.Contains(word);
with Ada.Strings.Fixed;
use Ada.Strings.Fixed;
Ok : Boolean := Index (S, Word) > 0;
ok = false
if s:find(word, 1, true) then ok = true end
ok = s:find(word, 1, true) ~= nil
val ok = s.contains(word)
var ok = s.includes(word);
#include <string>
ok = s.find(word) != std::string::npos;
(require '[clojure.string :as string])
(def ok (string/includes? word s))
val ok = s.contains(word)
ok = index(string, word) /= 0
Dim ok As Boolean = s.Contains(word)