# Check Unicode character class

**URL:** <https://discourse.julialang.org/t/check-unicode-character-class/28475>\
**Category:** General Usage\
**Created:** [September 6, 2019, 3:57pm UTC](https://discourse.julialang.org/t/check-unicode-character-class/28475 "2019-09-06T15:57:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deuxis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/deuxis/32/6295_2.png) [@Deuxis](https://discourse.julialang.org/u/Deuxis)\
**Post date:** [September 6, 2019, 3:57pm UTC](https://discourse.julialang.org/t/check-unicode-character-class/28475/1 "2019-09-06T15:57:32Z")

</div>

Hello, how can I check a `Char`’s Unicode character class? I need it for a lexer for a unicode-enabled language:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/2/12c33f1aa1ab0c9dc0cc51da7e4c1f8a4c971a78.png)  
I tracked down that `Char`’s `show` method uses `Unicode.category_abbrev`, but trying to import that function gives me an error and there doesn’t seem to be documentation for it anywhere.

---

<div class="post-metadata">

**Author:** ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)\
**Post date:** [September 6, 2019, 4:08pm UTC](https://discourse.julialang.org/t/check-unicode-character-class/28475/2 "2019-09-06T16:08:41Z")

</div>

The `Unicode` module is not exported, so you need to specify `Base.Unicode.category_abbrev`.

---

<div class="post-metadata">

**Author:** ![Deuxis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/deuxis/32/6295_2.png) [@Deuxis](https://discourse.julialang.org/u/Deuxis)\
**Post date:** [September 10, 2019, 9:59am UTC](https://discourse.julialang.org/t/check-unicode-character-class/28475/3 "2019-09-10T09:59:38Z")

</div>

Wow, that’s weird, it doesn’t work even if I explicitly import Unicode module, but does work when I also specify the Base part like you said. Is there a reason for this behaviour? Is module Unicode somehow different than the pre-imported Base.Unicode?

---

<div class="post-metadata">

**Author:** ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)\
**Post date:** [September 10, 2019, 10:11am UTC](https://discourse.julialang.org/t/check-unicode-character-class/28475/4 "2019-09-10T10:11:04Z")

</div>

`Unicode` is just a submodule of `Base`. The reason the `show` method doesn’t specify it with `Base.Unicode` is because the code is all in the module `Base`, so it has access to all its submodules automatically. If you don’t want to specify `Base.Unicode` every time, you can also put `using Base.Unicode` at the top of your code.

---

<div class="post-metadata">

**Author:** ![Deuxis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/deuxis/32/6295_2.png) [@Deuxis](https://discourse.julialang.org/u/Deuxis)\
**Post date:** [September 10, 2019, 11:32am UTC](https://discourse.julialang.org/t/check-unicode-character-class/28475/5 "2019-09-10T11:32:38Z")

</div>

Yes, I just thought that importing a module simply brings it into the scope, so I’m bewildered why does this happen:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/2/1/21a1d54e9b0f79f8b73d2ae053c5093ba34bdccf.png)

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [September 10, 2019, 11:39am UTC](https://discourse.julialang.org/t/check-unicode-character-class/28475/6 "2019-09-10T11:39:01Z")

</div>

You want `import .Unicode.category_abbrev`. Thers is an stdlib called Unicode as well.
