Logo

Programming-Idioms

  • C#
  • Haskell

Idiom #97 Check string suffix

Set boolean b to true if string s ends with string suffix, false otherwise.

Are the last characters of s equal to this suffix?
import Data.Text
b = isSuffixOf suffix s
var _b = _s.EndsWith(_suffix);
bool b = s.EndsWith(suffix);
(require '[clojure.string :as str])
(let [b (str/ends-with? s suffix)]
   ; ...  
 )

New implementation...