12-12-2018 05:42 PM
@paul_cardinale wrote:
Gee, I had no idea that the To Upper Case & To Lower Case functions worked on byte arrays.
Note that you can pull some of that stuff out of the loop (might make it faster):
I doubt it would make a huge difference but I think this will actually result in going over the data twice. Once for the To Upper/To Lower and then again for the For loop. Christian code would only have to touch the data once.
12-12-2018 06:23 PM
Nowhere in the problem statement did it say it had to properly handle non-alphabetic characters 🙂
12-12-2018 06:25 PM - edited 12-12-2018 06:27 PM
Paul, you never know what the compiler might do with all that, but your mod would in principle need to create allocations of several potentially very large arrays (2 exta U8, 2 Boolean!). Mine doesn't. 🙂
12-12-2018 07:28 PM
@BertMcMahan wrote:
Nowhere in the problem statement did it say it had to properly handle non-alphabetic characters 🙂
Because the problem description was vague I included the possibly(?) implied requirements. 😄
(Quote from above: "assuming all non-alphabetical characters should remain as is")
12-12-2018 07:36 PM
Oh it's certainly an "obvious" requirement, but my code doesn't work with that requirement so I opted for simplicity and "technical" correctness 😉
12-13-2018 06:45 AM - edited 12-13-2018 06:46 AM
Several example solutions have been provided.
There is a function in the Comparison palette called "Lexical Class" that is often overlooked.
Here is an example that uses the Lexical Class function.
Welcome to the world of LabVIEW!
12-13-2018 07:13 AM
How's this?
12-13-2018 10:33 AM
@paul_cardinale wrote:
How's this?
You are still allocation at least twice as much memory (probably more).
Also note that the entire left side could be replaced by a lexical class classification (4 or 5), which works on U8 (Of course the "class" is I16 (like your boolean to 0,1), so we are losing again 😉 I would still stick with a FOR loop for very large inputs. ;))
12-13-2018 10:49 AM
12-13-2018 11:31 AM - edited 12-13-2018 11:50 AM
@altenbach wrote:
@paul_cardinale wrote:
How's this?
You are still allocation at least twice as much memory (probably more).
Also note that the entire left side could be replaced by a lexical class classification (4 or 5), which works on U8 (Of course the "class" is I16 (like your boolean to 0,1), so we are losing again 😉 I would still stick with a FOR loop for very large inputs. ;))
OK. But I'm usually more concerned with speed that with size;
and this:
is about 30 times faster than this: