# Using (string-downcase ...) makes (eq? ...) fail

**URL:** <https://racket.discourse.group/t/using-string-downcase-makes-eq-fail/1664>\
**Category:** Questions & Answers\
**Created:** [January 26, 2023, 1:45pm UTC](https://racket.discourse.group/t/using-string-downcase-makes-eq-fail/1664 "2023-01-26T13:45:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grafcube](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/grafcube/32/623_2.png) [@Grafcube](https://racket.discourse.group/u/Grafcube)\
**Post date:** [January 26, 2023, 1:45pm UTC](https://racket.discourse.group/t/using-string-downcase-makes-eq-fail/1664/1 "2023-01-26T13:45:05Z")

</div>

I have these functions here

```plaintext
(define (greetfmt name)
  (string-append "Hello " name "!"))

(define (auth? name)
  (or
   (eq? name "alice")
   (eq? name "bob")))

(define (greet name)
;;(if (auth? name)
  (if (auth? (string-downcase name))
      (greetfmt name)
      "Huh?"))

```

When I use `(string-downcase)` the comparison operator fails.

With downcase. This happens for any input:

```plaintext
> (greet "alice")
"Huh?"

```

Without downcase:

```plaintext
> (greet "alice")
"Hello alice!"
> (greet "grafcube")
"Huh?"

```

This makes me think that downcase is doing something else to the string but after debugging for a while I haven't figured out what the problem is. Any help is appreciated.

---

<div class="post-metadata">

**Author:** ![benknoble](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/benknoble/32/16_2.png) [@benknoble](https://racket.discourse.group/u/benknoble)\
**Post date:** [January 26, 2023, 2:21pm UTC](https://racket.discourse.group/t/using-string-downcase-makes-eq-fail/1664/2 "2023-01-26T14:21:58Z")

</div>

cf. [https://docs.racket-lang.org/reference/Equality.html#%28part.\_model-eq%29](https://docs.racket-lang.org/reference/Equality.html#%28part._model-eq%29) and [https://docs.racket-lang.org/reference/strings.html](https://docs.racket-lang.org/reference/strings.html)

In particular, you almost certainly want `equal?` and not `eq?`.
