Daily Challenge #51

It has been to long without a Daily Challenge. I guess this one isn’t to hard.

Censor Words Longer Than Four Characters

Create a procedure that takes in a string and returns the string but with words over four characters to be censored with * .

Examples

censor('The code is fourty') ➞ 'The code is ******'

censor('Two plus three is five') ➞ 'Two plus ***** is five'

censor('aaaa aaaaa 1234 12345') ➞ 'aaaa ***** 1234 *****'

Notes

  • Don’t censor words with exactly four characters
  • If all words have four characters or less, return the original string
  • The amount of * is the same as the length of the word
4 Likes

This is my attempt …

8 Likes

When I saw this topic I thought that I missed a lot of Peter’s daily challenges and #50 is just a typo instead of #150. Actually not.

1 Like

Can anyone beat my 26 blocks solution and make it smaller still?

By the way, each time I tried to build the apk file, I got a parse error at install time, on two different Android devices. I had to duplicate the development on Thunkable (!!) to manage to get it through and test it. Can anyone point to what I should be tweaking on Kodular?

creative solution!

string is an input parameter and usually can’t be set…
use a local variable as return value

Taifun

1 Like

Nope, ain’t it:

This (by the way, that reduces block count to 25, but at the cost of additional memory usage) is also slapped with a parse error message at installation.

I was more expecting the issue to be along the line of having incompatible sdk, but trying different API level makes no difference.

1 Like

the blocks look fine, @KodularCreator might want to check this…
you might want to provide the aia file for them…

Taifun

see here:

Ok, thank you @bodymindpower
So @CBVG, what is your package name?
Taifun

Tstcnt

Why should it have an influence?

image

Packagename not appname. Packagename needs a certain format.

See here: Parse error when installation

1 Like