Abfrage auf leeres Feld, also auch keine Spaces

Wie frägt man am besten ab, ob ein Eingabefeld leer ist, mit “is empty” oder “length=0”?

Both methods should work. :slight_smile: Why not experiment and confirm this for yourself?

Ich habe beide getestet. Warum aber zwei Methoden, wenn sie dasselbe Ergebnis liefern? Diese müssen sich doch in der Wirkung unterscheiden.
Gerade deshalb habe ich gefragt, was besser ist.

Eine weitere Möglichkeit wäre zudem

compare texts text = “”

If the method works, use the method Dietrich. Checking length can be used to test for = 0 or =20 or =32; whatever length is critical to the comparison and developer. Empty means length=0 only. It has no flexibility other than an empty condition.

The developers of App Inventor attempt to provide as much programming flexibility as possible. So, depending what you as a developer are trying to achieve, compare texts text = “” might also be an option. There are frequently more than one way to program an algorithm. It is a wonderful ability.

OK,
aber ich war bisher gewohnt, nach der optimalen Lösung zu suchen bezüglich Speicher- und Zeitverbrauch, auch wenn es sich hier bei nur einzelnen Abfragen nicht groß auswirkt.
Dank für die Hilfe!

Es wäre nett, wenn man schon auch deutsch schreibt, zumindest die richtigen Wörter zu verwenden:
"Wie fragt man am besten ab ..."
damit u.a. der automatische Übersetzer - und ich - damit klarkommen.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.