# I am probably missing something very obvious. Can someone help me understand this?

**URL:** https://discourse.julialang.org/t/i-am-probably-missing-something-very-obvious-can-someone-help-me-understand-this/55193
**Category:** General Usage
**Created:** [February 13, 2021, 6:15am UTC](https://discourse.julialang.org/t/i-am-probably-missing-something-very-obvious-can-someone-help-me-understand-this/55193 "2021-02-13T06:15:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![BridgeBot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bridgebot/32/21491_2.png) [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)
#### Post date: [February 13, 2021, 6:15am UTC](https://discourse.julialang.org/t/i-am-probably-missing-something-very-obvious-can-someone-help-me-understand-this/55193/1 "2021-02-13T06:15:02Z")

</div>

I am probably missing something very obvious. Can someone help me understand this?

```julia
foo_string = "foo"
foo_dict = Dict("f"=&gt;0, "o"=&gt;0)

```

this:

```julia
haskey(foo_dict, "f")

```

returns: `true`

but why does

```julia
for char in foo_string
    print(char, " ", haskey(foo_dict, char))
end

```

returns this?

```julia
f false
o false
o false

```

What is a Julian way to check if a character in a string is in a dictionary key?

Thanks in advance.

Note that the original poster on Slack cannot see your response here on Discourse. Consider _transcribing the appropriate answer back to Slack_, or pinging the poster here on Discourse so they can _follow this thread_.  
[(Original message :slack:)](https://julialang.slack.com/archives/C6A044SQH/p1613196795209100?thread_ts=1613196795.209100&cid=C6A044SQH) [(More Info)](https://github.com/JuliaCommunity/SlackBridge)

---

<div class="post-metadata">

### Author: ![StevenSiew](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevensiew/32/218393_2.png) [@StevenSiew](https://discourse.julialang.org/u/StevenSiew)
#### Post date: [February 13, 2021, 9:14am UTC](https://discourse.julialang.org/t/i-am-probably-missing-something-very-obvious-can-someone-help-me-understand-this/55193/2 "2021-02-13T09:14:39Z")

</div>

```julia
julia> foo_string = "foo"
"foo"

julia> foo_dict = Dict("f"=>0, "o"=>0)
Dict{String,Int64} with 2 entries:
  "f" => 0
  "o" => 0

julia> for char in foo_string
         println("variable has type ",typeof(char))
       end
variable has type Char
variable has type Char
variable has type Char

julia> haskey(foo_dict,'f')
false

julia> typeof('f')
Char

# But if we do this instead

julia> haskey(foo_dict,"f")
true

julia> typeof("f")
String

julia> for char in foo_string
         println( char, " ", haskey(foo_dict, "$char") )
       end
f true
o true
o true

```
