# Why do split() and indexOf() treat qualityOf() differently - indexOf() requires toStr()

**URL:** <https://forum.inductiveautomation.com/t/why-do-split-and-indexof-treat-qualityof-differently-indexof-requires-tostr/104340>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [March 27, 2025, 10:01pm UTC](https://forum.inductiveautomation.com/t/why-do-split-and-indexof-treat-qualityof-differently-indexof-requires-tostr/104340 "2025-03-27T22:01:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hunterdg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hunterdg/32/67774_2.png) [@hunterdg](https://forum.inductiveautomation.com/u/hunterdg)\
**Post date:** [March 27, 2025, 10:01pm UTC](https://forum.inductiveautomation.com/t/why-do-split-and-indexof-treat-qualityof-differently-indexof-requires-tostr/104340/1 "2025-03-27T22:01:48Z")

</div>

Why does `split(qualityOf({value}), "Bad_NotFound”)` work but `indexOf(qualityOf({value}), "Bad_NotFound”)` does not?

why must i use `indexOf(toStr(qualityOf({value})), "Bad_NotFound”)`?

> **Example Binding**
>
> ```python
> {
> "type": "tag",
> "config": {
> "mode": "direct",
> "tagPath": "",
> "fallbackDelay": 2.5
> },
> "transforms": [
> {
> "expression": "split(qualityOf({value}), \"Bad_NotFound\")\r\n//indexOf(toStr(qualityOf({value})), \"Bad_NotFound\")\r\n//indexOf(qualityOf({value}), \"Bad_NotFound\")",
> "type": "expression"
> }
> ]
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 28, 2025, 12:07am UTC](https://forum.inductiveautomation.com/t/why-do-split-and-indexof-treat-qualityof-differently-indexof-requires-tostr/104340/2 "2025-03-28T00:07:31Z")

</div>

Because qualities are objects, not strings. `indexOf()` can accept a variety of data types, so it doesn't stringify your argument. `split()` requires a string, so it implicitly applies `toStr()` for you where necessary.

---

<div class="post-metadata">

**Author:** ![hunterdg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hunterdg/32/67774_2.png) [@hunterdg](https://forum.inductiveautomation.com/u/hunterdg)\
**Post date:** [March 28, 2025, 12:09am UTC](https://forum.inductiveautomation.com/t/why-do-split-and-indexof-treat-qualityof-differently-indexof-requires-tostr/104340/3 "2025-03-28T00:09:31Z")

</div>

Suppose the implicit bit is obvious in hindsight. Thanks!
