how do you create string of repeating characters?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel Billingsley

    how do you create string of repeating characters?

    How do I create a string consisting of a specified character repeated a
    specified number of times?

    Something like
    String.Fill('x' , 10) to create "xxxxxxxxxx "

    The best I see would be some hack using PadLeft() or (probably better) some
    method written from scratch.


  • 100

    #2
    Re: how do you create string of repeating characters?

    Hi Daniel,

    String str = new String('x', 10);

    This will do.

    HTH
    B\rgds
    100

    "Daniel Billingsley" <dbillingsley@N O.durcon.SPAAMM .com> wrote in message
    news:e8I4ZcioDH A.2772@TK2MSFTN GP12.phx.gbl...[color=blue]
    > How do I create a string consisting of a specified character repeated a
    > specified number of times?
    >
    > Something like
    > String.Fill('x' , 10) to create "xxxxxxxxxx "
    >
    > The best I see would be some hack using PadLeft() or (probably better)[/color]
    some[color=blue]
    > method written from scratch.
    >
    >[/color]


    Comment

    • Daniel Billingsley

      #3
      Re: how do you create string of repeating characters?

      DOH! Looked everywhere but there. Thanks.

      "100" <100@100.com> wrote in message
      news:e%23aj1hio DHA.1884@TK2MSF TNGP09.phx.gbl. ..[color=blue]
      > Hi Daniel,
      >
      > String str = new String('x', 10);
      >
      > This will do.
      >
      > HTH
      > B\rgds
      > 100
      >
      > "Daniel Billingsley" <dbillingsley@N O.durcon.SPAAMM .com> wrote in message
      > news:e8I4ZcioDH A.2772@TK2MSFTN GP12.phx.gbl...[color=green]
      > > How do I create a string consisting of a specified character repeated a
      > > specified number of times?
      > >
      > > Something like
      > > String.Fill('x' , 10) to create "xxxxxxxxxx "
      > >
      > > The best I see would be some hack using PadLeft() or (probably better)[/color]
      > some[color=green]
      > > method written from scratch.
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...