08-21-2023 02:02 PM
can someone solve this please
Solved! Go to Solution.
08-21-2023 02:09 PM
Sounds like a homework assignment. Regardless, we are here to help, not do you work for you. What have you tried? Where are you stuck? You need to show some effort to get any real help.
08-21-2023 03:05 PM
i tried this but couldn't complete it
08-21-2023 03:27 PM - edited 08-21-2023 03:28 PM
You'll need to convert your VI to a previous version. Open your VI and select File - Save to Previous Version. I believe LV 2018 is 18.0. You'd be pretty safe converting it to that. That way, almost all forum members can take a look and offer help.
08-21-2023 03:44 PM
i changed the version
08-21-2023 04:10 PM
I think you need to start over...
I see you are taking your text phrase and converting it into a byte array. If you right click on the right side of the String to Byte Array and select Crate - Indicator, you'll get a numeric array of unassigned integers which represent each character in your InputString.
Do a Google search on a ASCII table and focus on the Decimal column. What do you see?
08-21-2023 04:13 PM
Hi Arun,
Looks like a decent start, you are pretty close, but here are a few things to read that will help you:
1) ASCII Table: https://web.alfredstate.edu/faculty/weimandn/miscellaneous/ascii/ascii_index.html
2) Case Structures: https://www.youtube.com/watch?v=cgS3u0nupfs
3) Counter In Labview: https://www.youtube.com/watch?v=_GghNq9UmUg
4) For Loop: https://www.youtube.com/watch?v=ziOnPNJgeVg
Remark, you want to count but you have nothing in your code that will "add/ increment" number count when a vowel is seen. Try to find out why you have "black" broken wires and find a way to fix them first.
Hint:
1) You would want to increment a count when a vowel is seen and make no change in the counter value when the string value is not a vowel.
2) 'A' = 65 (U8, 8 bit data) and 'a' = 97 (U8 data).
3) You may want to consider lower case 'a' and upper case 'A' values.
08-21-2023 04:37 PM
When you come across a big problem you can't solve, break it down into smaller problems you CAN solve. Here is one such way to do it (hint: most of these could be individual subVI's...)
1: Figure out how to identify if a single letter is a vowel
2: Figure out how to increment a counter with a "Yes" input, and not increment it with a "No" input
3: Figure out how to split a string into individual letters
4: Figure out how to loop through a list of individual letters
If you can do each of those simpler tasks, you can do the main one.
08-22-2023 02:49 AM
If you want to loop over individual elements, I wouldn't convert to a byte array:
The string subset is very efficient, and won't copy the string. Instead it will return a substring, a decorated pointer to the original string. So there won't be data copies, and it will be fast.
However, if you set Search and Replace String to match a regular expression:
It count the replacements out of the box.
Note that I replace with a character (any character will do). If you don't wire the replacement, the string will be shrunk for every replacement, slowing things down.
08-22-2023 07:10 AM
wiebe@CARYA wrote:
However, if you set Search and Replace String to match a regular expression:
It count the replacements out of the box.
Note that I replace with a character (any character will do). If you don't wire the replacement, the string will be shrunk for every replacement, slowing things down.
I didn't know that not placing a replacement character can slow it down. I'll keep that in the memory bank for the next time I use it.