is there a nice way for creating a string initialized with a number of characters given an int (counter) and the character to set.
Simply put I would like a method that returns “#,#,#,#,#” when passed 5 and # as parameter.
Any ideas?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Using the StringUtils utility in the Apache Commons lang library:
If you only want the characters (and not the comma separators), it is just: