---
tags:
    - "String"
    - "Count"
    - "Size"
    - "Characters"
    - "Amount"
---

# Length

[Strings](index.md) / **Length**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

The amount of characters a text has

## Parameters

| Name | Description |
| :--- | :---------- |
| Text | The text whose characters are counted |

## Code

```cs
using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Length")]
    [Category("Strings/Length")]

    [Description("The amount of characters a text has")]
    [Image(typeof(IconString), ColorTheme.Type.Yellow, typeof(BadgeHash))]

    [Parameter("Text", "The text whose characters are counted")]

    [Keywords("String", "Count", "Size", "Characters", "Amount")]

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

        public override double GetPreview(GameObject source) => this.m_Text.GetPreview(source)?.Length ?? 0;

        public override double Get(Args args)
        {
            return this.m_Text.Get(args)?.Length ?? 0;
        }

        public override string ToString()
        {
            return $"Length of {this.m_Text}";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}

```

