Hi,
I looked at your code. Basically when you say
dim x as string() = {"A","B","C","D"}
It is an array of strings. Basically "A" is a string by itself. You could
also say something like
dim x as string() = {"abcd","hello"}
So now when you say x.clear(...), it will basically just make the index
that you specifly null. It will not resize the array.
But if you are just looking to create a string and manipulate its
characters then there are two ways to do it.
1) Use the System.String class and create a string as follows
Dim x as new String("Hello World")
then you can call x.remove(0,1), this will basically return a string with
one character removed. The origninal x will remain unchanged.The drawback
to using the String class is that it will generate a new string for every
string operation. So the other way to do is as follows
2) You can use the System.Text.Stringbuidler class. This class will do all
the operations on the source string. It is more like direct mainpulation of
the string stored in memory For example
Dim str As New String("hello world!")
MsgBox(str.Remove(0, 1))
MsgBox(str)
Dim MyStringBuilder As New StringBuilder("Hello World!")
MyStringBuilder.Remove(5, 7)
MsgBox(MyStringBuilder.ToString)
Str will still have the same value, but mystringbuilder will have only the
resultant value of the remove operation.
The following link has a detailed description
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconusingstringbuilderclass.asp
Anand Balasubramanian
Microsoft, Visual Basic .NET
This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks