07-15-2009 07:11 AM
Hello!
I am sure this is a simple thing to answer, but Labview help files and searches here have not given me any results, so I hope someone here can.
Is there any way I can make the "Scan from string function" case insensitive?
As illustrated above the code in the "no error" case will work as expected, however the code in the "error" case will not convert the string to the correct case, as the "A" is capitalized in the enum.
As the string I am converting will come from end-user input I would like this to be case insensitive.
So, thats the back story; Now for the question: Is it possible to use parameters in the "format string" input to make the scan case insensitive or do I have to add additional code? (i.e make the enum lower case, then use the "to lower case" conversion bullet)
07-15-2009 07:53 AM
No, you cannot change "Scan from String" to be case insensitive; at least i am not aware of....
What do you think about capitalize (To upper case) or lowercase (to lower case) all symbols before scanning?
hope this helps,
Norbert
07-15-2009 08:18 AM - edited 07-15-2009 08:22 AM
see that your Enum is Title case - you could convert the incoming string to Title.
07-15-2009 08:24 AM - edited 07-15-2009 08:29 AM
Aw...
Reading manuals: 10 minutes
Searching forum: 10 minutes
Writing a forum post: 15 minutes
...
Solving the problem with a workaround: 5 minutes
// edit:
VADave: A possibilty, but just to make this complicated I have "OK" in my enum as well. Writing a case to handle "OK", "Ok" and "ok" is just.. not ok.
07-15-2009 08:32 AM
Jan,
If your string is coming from user input, its probably not a good idea to directly try and convert it to an enum, there are going to be too many weird combinations that you will have to filter out.
N