Fixed length String

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

    #1

    Fixed length String

    Hi,

    How do create fixed length strings in c#, which is possible in VB6.0.

    i.e.
    dim str as string*10
    Is there anyway to handle this.

    regards,
    Mahesh.K


  • Richard A. Lowe

    #2
    Re: Fixed length String

    Of course there are probably ways to handle what you want... but what exact
    behaviour is it that you want to replicate? Is this an interop issue? or do
    you just want a string that will auto-truncate to 10 characters etc.

    R

    --
    Veuillez m'excuser, mon Français est très pauvre. Cependant, si vous voyez
    mauvais C #, c'est mon défaut!
    "maheshk" <mahik_78@hotma il.com> wrote in message
    news:%23SoJFz2o DHA.648@TK2MSFT NGP11.phx.gbl.. .[color=blue]
    > Hi,
    >
    > How do create fixed length strings in c#, which is possible in VB6.0.
    >
    > i.e.
    > dim str as string*10
    > Is there anyway to handle this.
    >
    > regards,
    > Mahesh.K
    >
    >[/color]


    Comment

    • mahesh kumar

      #3
      Re: Fixed length String

      Thanks for the update Richard.

      Can i declare a varriable type string of length say 10.

      so that i don't waste the memory allocating for 255 characters.

      Is this possible.

      regards,
      Mahesh.K

      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • Muscha

        #4
        Re: Fixed length String

        > Can i declare a varriable type string of length say 10.[color=blue]
        >
        > so that i don't waste the memory allocating for 255 characters.[/color]

        string wont waste 255 characters. Besides string is immutable, it won't
        grow/shrink, it will be just it.


        /m
        [color=blue]
        > Is this possible.
        >
        > regards,
        > Mahesh.K
        >
        > *** Sent via Developersdex http://www.developersdex.com ***
        > Don't just participate in USENET...get rewarded for it![/color]


        Comment

        • Richard A. Lowe

          #5
          Re: Fixed length String

          What he said...

          --
          Veuillez m'excuser, mon Français est très pauvre. Cependant, si vous voyez
          mauvais C #, c'est mon défaut!
          "Muscha" <muscha@no.spam .net> wrote in message
          news:eD9D$Z3oDH A.2012@TK2MSFTN GP12.phx.gbl...[color=blue][color=green]
          > > Can i declare a varriable type string of length say 10.
          > >
          > > so that i don't waste the memory allocating for 255 characters.[/color]
          >
          > string wont waste 255 characters. Besides string is immutable, it won't
          > grow/shrink, it will be just it.
          >
          >
          > /m
          >[color=green]
          > > Is this possible.
          > >
          > > regards,
          > > Mahesh.K
          > >
          > > *** Sent via Developersdex http://www.developersdex.com ***
          > > Don't just participate in USENET...get rewarded for it![/color]
          >
          >[/color]


          Comment

          Working...