And it won't work. I get sss that the same to str_rand, but I need for ex.:
str_rand= 23 than I expect sss=**
str_rand= 2543 than I expect sss=****
str_rand= 3 than I expect sss=*
What shall I do?
Stefan Evans wrote:At the risk of over simplifying, rather than replacing the current string characters, why not just create a string of '*' characters, the same length as the current one?
A simple loop using a StringBuilder to create the string of asterisks would do the trick.
Stefan your solution is very simple and easy.
Campbell Ritchie wrote:Nice solution (apart from the poorly chosen variable names).
Solution was inspired from :