Repeated character in a text with output boolean

jospercomp shared this question 1 year ago
Answered

How to create a function that determines if there is at least some repetition of some character in a text.

"ABA" is true

"ABC" is false

"121" is true

"123" is false.

Best Answer
photo

How about

Length(TextToUnicode(text1))==Length(Unique(TextToUnicode(text1)))

Comments (4)

photo
2

How about

Length(TextToUnicode(text1))==Length(Unique(TextToUnicode(text1)))

photo
1

Thank you so much!!!

photo
1

Sort(RemoveUndefined(Flatten(Sequence(Sequence(Sequence(Sequence(

If( Length({a,b,c,d}) == Length(Unique({a,b,c,d})) &&

Sum(Sequence(Element({a,b,c,d}, i) < Element({a,b,c,d}, i + 1), i, 1, Length({a,b,c,d}) - 1, 1)) == 3

&& Sum(Sequence(Element({a,b,c,d}, i) == 4, i, 1, Length({a,b,c,d}), 1)) == 1,

{"" + (UnicodeToLetter(64 + a)) + "" + (UnicodeToLetter(64 + b))

+ "" + (UnicodeToLetter(64 + c))+ "" + (UnicodeToLetter(64 + d))})

, a, 1, 7), b, 1, 7), c, 1, 7), d, 1, 7))))


////////////////////////////////////////////////////////////////////


Sort(RemoveUndefined(Flatten(Sequence(Sequence(Sequence(Sequence(

If( Length({a,b,c,d}) == Length(Unique({a,b,c,d})) &&

Sum(Sequence(Element({a,b,c,d}, i) < Element({a,b,c,d}, i + 1), i, 1, Length({a,b,c,d}) - 1, 1)) == 3,

{"" + (UnicodeToLetter(64 + a)) + "" + (UnicodeToLetter(64 + b))

+ "" + (UnicodeToLetter(64 + c))+ "" + (UnicodeToLetter(64 + d))})

, a, 1, 7), b, 1, 7), c, 1, 7), d, 1, 7))))


////////////////////////////////////////////////////////////////////


Sort(RemoveUndefined(Flatten(Sequence(Sequence(Sequence(Sequence(

If( Length({a,b,c,d}) == Length(Unique({a,b,c,d})),

{"" + (UnicodeToLetter(64 + a)) + "" + (UnicodeToLetter(64 + b))

+ "" + (UnicodeToLetter(64 + c))+ "" + (UnicodeToLetter(64 + d))})

, a, 1, 7), b, 1, 7), c, 1, 7), d, 1, 7))))

photo
photo
2

In some cases, the following version is helpful:

© 2022 International GeoGebra Institute