Re: MyMutableString Class

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Sep 16, 4:22 pm, "Alberto Poblacion" <earthling-
quitaestoparacontes...@xxxxxxxxxxxxx> wrote:
"vaib" <vaibhavpang...@xxxxxxxxx> wrote in message

news:47896db3-6c96-4f56-93a9-b367ef5f96d9@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

What should I do if I have to make a class , say, MyMutableString ,
that takes in a String object ( any string literal ) and does
modifications ( like append, etc ) on the same memory location where
that String object is stored without making use of pointers (, ie, not
making use of any unsafe code ). So the question boils down to - How
can I possibly access the memory location where the String object is
stored without the use of unsafe code ?? If I am able to do it then
making the "MyMutableString" class won't be a hassle.

I have searched a lot for this problem and no solution seems to be in
sight. So i turn to usenet ( as always ) for help.

   Inside your class, you could allocate a char array with enough space for
the largest string that you wish to manipulate. Then store the characters of
the string in the char array. You can manipulate the string without
allocating or deallocating memory by just moving around the chars in the
array (and keeping a local variable to serve as an index to the last
position in use).

but character array would not be at the same memory location. I need
to access the memory location of the string..!
.



Relevant Pages

  • Re: Outdated help (feat. Access 97 and VB4)
    ... that vbNullString is not a string purely because it doesn't point to a ... on a variable being of string type. ... pointer to the memory location of the variable the pointer to the variable ...
    (comp.databases.ms-access)
  • Re: ApostaC - Variadic functions RFCAS
    ... treat a string as a number or suchlike *very hard*. ... varargs and type-safety were different issues. ... first and varargs second, ... I assume Bill's point was that 42 ISN'T a memory location: ...
    (comp.programming)
  • Re: Outdated help (feat. Access 97 and VB4)
    ... allocated memory to point to a string space, but the string space they point to is different. ... The traditional explanation is that vbNullString points to ... In the four bytes before the memory location we find ... The string pointer points to a memory ...
    (comp.databases.ms-access)
  • Re: MyMutableString Class
    ... can I possibly access the memory location where the String object is ... the same way you access any memory location without the use of unsafe code: ... That said, if what you want is a mutable string, why not just use the StringBuilder class? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: MyMutableString Class
    ... that takes in a String object and does ... that String object is stored without making use of pointers (, ie, not ... can I possibly access the memory location where the String object is ... you could allocate a char array with enough space for the largest string that you wish to manipulate. ...
    (microsoft.public.dotnet.languages.csharp)