In the blocks, when you press button, the Label text is replaced with whatever the user typed in TextBox. Also all the Vowels are removed.
Is it possible to also remove any DOUBLE letters? Example: if user typed "APPLE", I would want it to return as "APLE". With Vowels gone it should only return, "PL"
--
segment PP
replacement P will take one of the Ps away
--
Hey thanks for the reply. That only seems to work if the Ps are next to each other. I am thinkin more like, Take away any of the same letters in a sentence. I should also say, Apple was just an example. Ideally I want ANY double of a letter to be removed from a sentence. No set letter, just any double of a letter needs to go. lol
--
A different way to attack this would be to build up a second (output) string from empty,
walking through the input string letter by letter, and for each letter,
skip it if it's a vowel or if it's already in your output string,
otherwise JOIN it onto the end of your output string.
--
Heya Abraham thank you for your input. I'm not exactly sure what you mean, Today is my first day using App Inventor. Is it possible you could screenshot a very simple example of what you mean? All I need is a starting point, not sure how to set it uo tho : )
--
I'm not really sure what you mean by "Skip" thats basically my issue, I dont know what would cause it to skip or remove letters.
--
See chapter 19 here http://www.appinventor.org/book2 it may help...also, the entire Inventor's Manual can be read in about an hour. This book is one of the best introductions to AI Blocks anywhere.
--
Here's the algorithm in a C-like pseudocode...
set global vowels = 'aeiou'
set global another = empty string
for i = 1 to length(input_string) by 1
set local variable L = letter at input_string position i
if AND(not(contains(vowels,L)),not(contains(another,L)) // not a vowel or already in another
then set another = JOIN(another,L)
end for i
// another contains all consonants of input_string
P.S. This can be made even shorter using DeMorgan's Law and a JOIN.
--