I am having my string as "Date :<#Tag(SystemTagDateTime)> Value1 : <#Tag(value1)>" I want to replace SystemTagDateTime , value1 by its value and want to show whole string in Message Box as "Date :2016-05-18 10:00:00 Value1 : 10"
My Initial string may have one or more than one <#Tag(Anything)>.I have tried but failed to get desired value For Example
line -> Date :<#Tag(SystemTagDateTime)> Value1 : <#Tag(value1)>
string[] values =Regex.Split(line, "<#Tag\\(|\\)>").Where(x => x != string.Empty).ToArray();
string text = "";
foreach (string val in values) {
if (!(String.IsNullOrEmpty (val.Trim ())))
{
foreach(GlobalDataItem gdi in Globals.Tags.GlobalDataItems)
{
MessageBox.Show(val);
if (gdi.Name == val)
{
text+= gdi.Value;
}
}
}
else
{
text += val ;
}
}