UNPKG

locutus

Version:

Locutus other languages' standard libraries to JavaScript for fun and educational purposes

12 lines (11 loc) 469 B
import { strstr } from "../strings/strstr.js"; export function strchr(haystack, needle, bool) { // discuss at: https://locutus.io/php/strchr/ // parity verified: PHP 8.3 // original by: Philip Peterson // example 1: strchr('Kevin van Zonneveld', 'van') // returns 1: 'van Zonneveld' // example 2: strchr('Kevin van Zonneveld', 'van', true) // returns 2: 'Kevin ' return strstr(haystack, needle, bool); }