J
J. Oliver
I am attempting to copy a portion of a string into another string. Say
I have "abcdef" in string 'a' and want to copy only "bcd" into a new
string 'b'. The following function came to mind:
public string GetText(string a, int start, int end)
{
int i;
string b;
for (i=0;i<(end-start);i++)
{
b=(a[start+i]);
}
return b;
}
At compile time, I am getting the error: "Property or indexer
'string.this[int]' cannot be assigned to -- it is read only"
Which makes sense, since I am attempting to increase the sisce of a
fixed string. Is there an easier way to do this?
- j. oliver
I have "abcdef" in string 'a' and want to copy only "bcd" into a new
string 'b'. The following function came to mind:
public string GetText(string a, int start, int end)
{
int i;
string b;
for (i=0;i<(end-start);i++)
{
b=(a[start+i]);
}
return b;
}
At compile time, I am getting the error: "Property or indexer
'string.this[int]' cannot be assigned to -- it is read only"
Which makes sense, since I am attempting to increase the sisce of a
fixed string. Is there an easier way to do this?
- j. oliver