Checks if the given string starts with the given substring.

Type signature

(prefix: string) => (xs: string) => boolean

Examples

startsWith("The")(
  "The quick brown fox jumps over the lazy dog"
);
// ⇒ true
Try in REPL
startsWith("Quick")(
  "The quick brown fox jumps over the lazy dog"
);
// ⇒ false
Try in REPL

Questions

  • How to check if a string starts with a given substring?

TypeScript sourceJavaScript source