public string ChangeFieldValue(string value,string filed,string newValue)
{
int length = value.Length;
int fieldLength = filed.Length;
int i = 0;

while(i+fieldLength<=length)
{
string str = value.Substring(i, fieldLength);
if (str.ToLower() == filed.ToLower())
{
int start = -1;
int end = -1;
int j = i+fieldLength;

while (j < length)
{
if (value[j].ToString() == “\””)
{
start = j + 1;
j++;
break;
}
j++;
}

while (j < length)
{
if (value[j].ToString() == “\””)
{
end = j – 1;
j++;
break;
}
j++;
}

if (start != -1 && end != -1)
{
value = value.Remove(start, end – start + 1);
value = value.Insert(start, newValue);
length = value.Length;
}
}
i++;
}
return value;
}
}

embedCode = ChangeFieldValue(embedCode, “height”, “200″);

embedCode = ChangeFieldValue(embedCode, “width”, “200″);

Advertisements