Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subs 3rd arg should be exclusive-end, not number of chars from start #248

Open
frenchy64 opened this issue Feb 7, 2025 · 0 comments · May be fixed by #253
Open

subs 3rd arg should be exclusive-end, not number of chars from start #248

frenchy64 opened this issue Feb 7, 2025 · 0 comments · May be fixed by #253

Comments

@frenchy64
Copy link
Contributor

frenchy64 commented Feb 7, 2025

;; jank
clojure.core=> (subs "abcde" 1 4)
"bcde"
clojure.core=> (subs "abcde" 1 1)
"b"
clojure.core=> (subs "asdf" 3 1)
"f"

;; clojure
user=> user=> (subs "abcde" 1 4)
"bcd"
user=> (subs "abcde" 1 1)
""
user=> (subs "asdf" 3 1)
Execution error (StringIndexOutOfBoundsException) at jdk.internal.util.Preconditions$1/apply (Preconditions.java:55).
Range [3, 1) out of bounds for length 4

;; from clojure-test

FAIL in (nil) (nil:nil)
expected: (= "bcd" (subs "abcde" 1 4))
  actual: (not (= "bcd" "bcde"))
@frenchy64 frenchy64 changed the title subs end should be exclusive subs 3rd arg is exclusive-end, not number of chars from start Feb 8, 2025
@frenchy64 frenchy64 changed the title subs 3rd arg is exclusive-end, not number of chars from start subs 3rd arg should be exclusive-end, not number of chars from start Feb 8, 2025
@jeaye jeaye removed the type:bug label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants