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 Numeric#

Strings / Is Numeric

  • Can Read

  • Cannot Write

Description#

Returns True if the whole text can be interpreted as a number

Parameters#

Name Description
Text The text that is checked

Code#

using System;
using System.Globalization;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

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

    [Description("Returns True if the whole text can be interpreted as a number")]
    [Image(typeof(IconNumber), ColorTheme.Type.Yellow, typeof(BadgeString))]

    [Parameter("Text", "The text that is checked")]

    [Keywords("String", "Number", "Parse", "Digit", "Valid", "Float", "Integer")]

    [Serializable]
    public class TypeBoolStringIsNumeric : TypeBool
    {
        [SerializeField] private GetString m_Text = new GetString();

        public override bool GetPreview(GameObject source) => IsNumeric(this.m_Text.GetPreview(source));

        public override bool Get(Args args) => IsNumeric(this.m_Text.Get(args));

        private static bool IsNumeric(string text)
        {
            if (string.IsNullOrWhiteSpace(text)) return false;
            return double.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, out _);
        }

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

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