This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-31
Channels
- # aws (18)
- # babashka (35)
- # beginners (7)
- # cider (3)
- # clara (2)
- # clj-kondo (15)
- # cljs-dev (1)
- # cljsrn (3)
- # clojure (20)
- # clojure-canada (1)
- # clojure-dev (3)
- # clojure-spec (17)
- # clojure-uk (13)
- # clojutre (1)
- # cursive (7)
- # datomic (1)
- # duct (7)
- # fulcro (33)
- # helix (77)
- # jobs (3)
- # malli (15)
- # meander (3)
- # off-topic (30)
- # pathom (3)
- # quil (1)
- # reagent (1)
- # reitit (10)
- # shadow-cljs (2)
- # tools-deps (5)
- # xtdb (6)
- # yada (1)
Hi guys, I'm stuck on something simple. I'm trying to find if the last character of a string ends in a "?". I tried ends-with?
but that doesn't seem to produce the result I want. I thought maybe I could split a string like in JavaScript "Hello".split(-1)
where I grab the last character of a string and then check what the value is but having trouble with that.
Do you have an example where ends-with?
does not produce the result you want?
Sure probably should have led with that 🙂 (ends-with? "?" "Hello?") ;; => false
. Not sure if this could be the issue but in the namespace I'm requiring string and aliasing it so the code actually looks something like this:
(ns bob
(:require [clojure.string :as s]))
(s/ends-with? "?" "Hello?")
Ahhhh, dangit. That was it. Thanks lot.