LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lowercase to Uppercase and Uppercase to Lowercase


@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):

cs.png


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.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 11 of 38
(2,236 Views)

sTrInG.png

 

Nowhere in the problem statement did it say it had to properly handle non-alphabetic characters 🙂

0 Kudos
Message 12 of 38
(2,228 Views)

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. 🙂

0 Kudos
Message 13 of 38
(2,226 Views)

@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")

0 Kudos
Message 14 of 38
(2,205 Views)

Oh it's certainly an "obvious" requirement, but my code doesn't work with that requirement so I opted for simplicity and "technical" correctness 😉

Message 15 of 38
(2,203 Views)

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.

 

Invert Case.png

 

Welcome to the world of LabVIEW!


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Message 16 of 38
(2,184 Views)

How's this?

cs2.png

"If you weren't supposed to push it, it wouldn't be a button."
Message 17 of 38
(2,174 Views)

@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. ;))

0 Kudos
Message 18 of 38
(2,146 Views)

@altenbach wrote: 

SwapLetterCase.png

 


Any reason not to simplify further?

Case Swap.png

 

Message 19 of 38
(2,137 Views)

@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:

 

 csw4.png

is about 30 times faster than this:

csw2.png

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 20 of 38
(2,113 Views)