7 Replies
now in the part where i ask for name nationality and residence how do i restrict user from entering numbers?
Once the user pressed return, you need to run a validation method on it to check that it only contains what you want. If invalid, you prompt that to the user and re-ask them for the data.
Thanks but how tho. Couldnt find any useful guide online.
The general scheme is
You need to write
IsValidName
based on your requirements
If you need to check if a string contains no numbers, you can use char.IsDigit
on each letter in the stringOk I'm done for today. Thank you tho.
name.Any(char.IsDigit)
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.