Hi Tommy

I don't think that there is any inbuilt method in Java for performing
repeatChar but you can always create your utility method for the same.

Regards
Surbhi

On Thu, Jun 25, 2009 at 8:02 AM, Tom Anderson <[email protected]> wrote:

>
> Don't know about a built-in method. I'd make a repeatChar method like
> this:
>
>
>    public static String repeatChar(char a, int numTimes){
>        StringBuffer p = new StringBuffer();
>        for (int i = 0; i<numTimes; i++) p.append(a);
>        return p.toString();
>    }
>
>
>
> Tommy
>
>
>
> On Jun 25, 2:07 am, Al Catraz <[email protected]> wrote:
> > I am seeking the Java-built-in method ==  if such exists..   THNX
> >
> > On Jun 24, 10:20 am, Al Catraz <[email protected]> wrote:
> >
> > > I am seeking the method to construct a string from a repeat of a char
> > > n times
> >
> > > something like
> >
> > > String s = repeatChar("*", 8);                     \\  will return a
> > > string =  "********"
> >
> > > Is there such a method?
> >
> > > Thanks
> >
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to