Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3.  
  4. public 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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement