You can create a StringBuffer object to do this.   Within a for loop call
the append(char c) method of StringBuffer for each occurrence.  It is
fairly easy to put this in a method where you pass the character and the
number of occurrences.  Once you have the StringBuffer built you can call
the toString() method and pass it back..   The String can then be used or
display as needed.



                                                                                       
                            
                    "Emmanuel Eze"                                                     
                            
                    <eze@systemspe       To:     "JDJList" 
<[EMAIL PROTECTED]>                           
                    cs.com.ng>           cc:                                           
                            
                                         Subject:     [jdjlist] repeating a character 
n times in JSP               
                    05/16/02 09:18                                                     
                            
                    AM                                                                 
                            
                    Please respond                                                     
                            
                    to "JDJList"                                                       
                            
                                                                                       
                            
                                                                                       
                            




Hi all,

Does anyone know any java class or method that will enable me repeat a
character n times?

Example:  if I want "******", I will call methodname('*',6).

Thanks in advance

Emma


To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm





To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

Reply via email to