判断字符串是否与变量相符
利用Equals()来判断字符串是否与变量一致
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MainPlayer : MonoBehaviour
{
public string Name;
void Start()
{
if (Name.Equals("LBW"))
{
Debug.Log("欢迎回来");
}
else
{
Debug.Log("不存在的名字");
}
}
}
标签:变量,相符,System,字符串,using,Log
From: https://www.cnblogs.com/FstBlog/p/17124283.html