# Need to make sure text or numbers are entered in components

**URL:** <https://forum.inductiveautomation.com/t/need-to-make-sure-text-or-numbers-are-entered-in-components/79441>\
**Category:** General Discussion\
**Tags:** perspective\
**Created:** [September 21, 2023, 9:24am UTC](https://forum.inductiveautomation.com/t/need-to-make-sure-text-or-numbers-are-entered-in-components/79441 "2023-09-21T09:24:10Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Felipe\_CRM](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@Felipe\_CRM](https://forum.inductiveautomation.com/u/Felipe_CRM)\
**Post date:** [September 21, 2023, 3:30pm UTC](https://forum.inductiveautomation.com/t/need-to-make-sure-text-or-numbers-are-entered-in-components/79441/11 "2023-09-21T15:30:45Z")

</div>

I'm not sure there's any built-ins for checking if a string contains only numeric characters or only alphabetic characters. You could use `toInt()` or `toFloat()` with the fallback option to do it, like in this post:

> [@\[BUG\] 8.1.0rc3 Numeric expression on string returns 0 instead of failover](https://forum.inductiveautomation.com/t/bug-8-1-0rc3-numeric-expression-on-string-returns-0-instead-of-failover/40170):
>
> I’m trying to use toInt({value}, -999999) to check if the value is a string or a number, however the expression returns “0” even if the value is a string like “off”. Is there any other way that I can check this?

but I think this is one case where a script transform would be worth it.

Python has some nice built-ins like `isalpha()` (a-z only), `isalnum()` (a-z + digits allowed but no special characters), and `isnumeric()` (only digits allowed). For anything more complicated you'd have to do regex like Transistor said.

Please correct me if I'm missing anything.

---

_[View the full topic](https://forum.inductiveautomation.com/t/need-to-make-sure-text-or-numbers-are-entered-in-components/79441)._
