---
tags:
    - "String"
    - "Compare"
    - "Same"
    - "Match"
    - "Identical"
---

# Equals

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

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

Returns True if two texts are exactly the same

## Parameters

| Name | Description |
| :--- | :---------- |
| Text 1 | The text targeted |
| Text 2 | The text to compare against |
| Ignore Case | Whether upper and lower case characters are considered the same |

## Code

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

namespace VisualScript.Runtime
{
    [Get]

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

    [Description("Returns True if two texts are exactly the same")]
    [Image(typeof(IconEqualsCircle), ColorTheme.Type.Yellow, typeof(BadgeString))]

    [Parameter("Text 1", "The text targeted")]
    [Parameter("Text 2", "The text to compare against")]
    [Parameter("Ignore Case", "Whether upper and lower case characters are considered the same")]

    [Keywords("String", "Compare", "Same", "Match", "Identical")]

    [Serializable]
    public class TypeBoolStringEquals : TypeBool
    {
        [SerializeField] private GetString m_Text1 = new GetString();
        [SerializeField] private GetString m_Text2 = new GetString();
        [SerializeField] private GetBool m_IgnoreCase = new GetBool(false);

        public override bool GetPreview(GameObject source) => Equals(
            this.m_Text1.GetPreview(source),
            this.m_Text2.GetPreview(source),
            this.m_IgnoreCase.GetPreview(source)
        );

        public override bool Get(Args args) => Equals(
            this.m_Text1.Get(args),
            this.m_Text2.Get(args),
            this.m_IgnoreCase.Get(args)
        );

        private static bool Equals(string text1, string text2, bool ignoreCase)
        {
            return string.Equals(text1, text2, ignoreCase
                ? StringComparison.OrdinalIgnoreCase
                : StringComparison.Ordinal);
        }

        public override string ToString()
        {
            return $"{this.m_Text1} = {this.m_Text2}";
        }

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

```

