Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. public void OnValueDateChanged(string input)
  2. {
  3. int index = 0;
  4. string format = "##/##/####";
  5.  
  6. string output = format;
  7.  
  8. for (int i = 0; i < input.Length; ++i)
  9. {
  10. index = output.IndexOf("#");
  11. if (index < 0)
  12. break;
  13. if (index == 0)
  14. output = input[i] + output.Substring(1);
  15. else if (index == output.Length - 1)
  16. output = output.Substring(0, index) + input[i];
  17. else
  18. output = output.Substring(0, index) + input[i] + output.Substring(index + 1);
  19. }
  20.  
  21. if (index >= 0)
  22. output = output.Substring(0, index + 1);
  23.  
  24.  
  25. if (input.Length == 0)
  26. {
  27. output = string.Empty;
  28. }
  29.  
  30. dataNasciOutput.text = output;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement