Hi, I’m struggling to find the right format to see if a list of 2 character strings are integers or not. Most are but there are a couple of exceptions. I’m trying to generate a list of True or False.
Any expression I try throws an error when it hits the non-integer entries. Is there a way? I feel I need an ‘IsInt’ function, or something to catch the errors?
(I’d considered forcing it through an Integer data type component, but read that a few key characters can slip through (such as lower case ‘e’))
I guess an alternative approach would be to test for the digits 0 to 9 and the space character - anything else should be discarded (these are room numbers so won’t ever be floating point).
if each of your strings to be filtered contains for sure at least a letter, you can take advantage of the thing that letters can have Upper and Lower case
so you can make a string all uppercase and check if any character changed, or make a whole string lowercase and also check if any character changes
if any of the above happened, then the string contains a letter and goes False
so this answers the True/False statement “this string does not contains letters”, nothing related to integers and symbols
Thanks, that’s very innovative! Unfortunately they may not all contain a letter - it depends on what our clients write in their spreadsheet! In the test case I’m working with, there are a couple of brackets too.
Basically I can’t guarantee what will be in the string, but it may or may not end in a number. If it does, I’d like to separate the number, perform some actions on the rest of the string, and add the number back on if there was one.