· 6 years ago · Oct 22, 2019, 12:44 PM
1using UnityEngine;
2using UnityEngine.UI;
3
4public class UIController : MonoBehaviour
5{
6 private string _mailForm = "@gmail.com";
7
8
9 private string _mailCheck;
10 private InputField _inputField;
11
12 private void Start()
13 {
14 _inputField = gameObject.GetComponentInChildren(typeof(InputField)) as InputField;
15 }
16
17 public void ApplyButton()
18 {
19 if (_inputField.text.Length > _mailForm.Length && _inputField.text.EndsWith(_mailForm))
20 {
21 // Debug.Log(_inputField.text);
22 }
23 ApplyButton2();
24 }
25 public void ApplyButton2()
26 {
27 int _countCheckValue = 0;
28 for (int i = _inputField.text.Length - _mailForm.Length; i < _inputField.text.Length; i++)
29 {
30 if (_inputField.text[i] == _mailForm[i - (_inputField.text.Length - _mailForm.Length)])
31 {
32 _countCheckValue++;
33 }
34 }
35 if (_countCheckValue == _mailForm.Length && _mailForm.Length != _inputField.text.Length)
36 {
37 Debug.Log(_inputField.text);
38 }
39 else
40 Debug.Log("error");
41 }
42}