Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

Is Empty#

Strings / Is Empty

  • Can Read

  • Cannot Write

Description#

Returns True if the text has no characters at all

Parameters#

Name Description
Text The text that is checked
Ignore Whitespaces Whether a text made only of spaces, tabs and new lines counts as empty

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Is Empty")]
    [Category("Strings/Is Empty")]

    [Description("Returns True if the text has no characters at all")]
    [Image(typeof(IconNull), ColorTheme.Type.Yellow, typeof(BadgeString))]

    [Parameter("Text", "The text that is checked")]
    [Parameter("Ignore Whitespaces", "Whether a text made only of spaces, tabs and new lines counts as empty")]

    [Keywords("String", "Null", "None", "Blank", "Whitespace", "Length")]

    [Serializable]
    public class TypeBoolStringIsEmpty : TypeBool
    {
        [SerializeField] private GetString m_Text = new GetString();
        [SerializeField] private GetBool m_IgnoreWhitespaces = new GetBool(true);

        public override bool GetPreview(GameObject source) => IsEmpty(
            this.m_Text.GetPreview(source),
            this.m_IgnoreWhitespaces.GetPreview(source)
        );

        public override bool Get(Args args) => IsEmpty(
            this.m_Text.Get(args),
            this.m_IgnoreWhitespaces.Get(args)
        );

        private static bool IsEmpty(string text, bool ignoreWhitespaces)
        {
            return ignoreWhitespaces
                ? string.IsNullOrWhiteSpace(text)
                : string.IsNullOrEmpty(text);
        }

        public override string ToString()
        {
            return $"{this.m_Text} is Empty";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.