Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void OnValueDateChanged(string input)
- {
- int index = 0;
- string format = "##/##/####";
- string output = format;
- for (int i = 0; i < input.Length; ++i)
- {
- index = output.IndexOf("#");
- if (index < 0)
- break;
- if (index == 0)
- output = input[i] + output.Substring(1);
- else if (index == output.Length - 1)
- output = output.Substring(0, index) + input[i];
- else
- output = output.Substring(0, index) + input[i] + output.Substring(index + 1);
- }
- if (index >= 0)
- output = output.Substring(0, index + 1);
- if (input.Length == 0)
- {
- output = string.Empty;
- }
- dataNasciOutput.text = output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement