String comparison on micro grams(μg) is failing
Posted: Wed Feb 07, 2018 11:59 pm
Hi ,
There is a button on which the text is displayed in micro gram units. For example: 20 μg
Steps i followed:
1. Set the expected value in the parameter using data binding . For example: inputVolumeParameter=20 μg
2.Loop through the list of available buttons through and verify if the text on the button is same as the input parameter that is set in step1
For Example:
if(string.Compare(volumeText.TextValue,inputVolumeParameter,true)==0)
{
Report.Log(ReportLevel.Info,"MATCH FOUND " );
}
else
{
Report.Log(ReportLevel.Info," MATCH NOT FOUND " );
}
String comparison is always failing on the 'μg' when i did the following
string[] tempStr = volumeText.TextValue.Split(new string[]{" "}, StringSplitOptions.None);
string [] tempStr1= Volume.Split(new string[]{" "}, StringSplitOptions.None);
bool b= string.Compare(tempStr[0], tempStr1[0], CultureInfo.InvariantCulture, CompareOptions.IgnoreSymbols ) == 0;
bool b1= string.Compare(tempStr[1], tempStr1[1], CultureInfo.InvariantCulture, CompareOptions.IgnoreSymbols) == 0;
Report.Log(ReportLevel.Info,tempStr[0] +" " + tempStr1[0] + " " + b);
Report.Log(ReportLevel.Info,tempStr[1] +" " + tempStr1[1] + " " + b1);
Can anyone help me with this?
Thanks,
Rekha
There is a button on which the text is displayed in micro gram units. For example: 20 μg
Steps i followed:
1. Set the expected value in the parameter using data binding . For example: inputVolumeParameter=20 μg
2.Loop through the list of available buttons through and verify if the text on the button is same as the input parameter that is set in step1
For Example:
if(string.Compare(volumeText.TextValue,inputVolumeParameter,true)==0)
{
Report.Log(ReportLevel.Info,"MATCH FOUND " );
}
else
{
Report.Log(ReportLevel.Info," MATCH NOT FOUND " );
}
String comparison is always failing on the 'μg' when i did the following
string[] tempStr = volumeText.TextValue.Split(new string[]{" "}, StringSplitOptions.None);
string [] tempStr1= Volume.Split(new string[]{" "}, StringSplitOptions.None);
bool b= string.Compare(tempStr[0], tempStr1[0], CultureInfo.InvariantCulture, CompareOptions.IgnoreSymbols ) == 0;
bool b1= string.Compare(tempStr[1], tempStr1[1], CultureInfo.InvariantCulture, CompareOptions.IgnoreSymbols) == 0;
Report.Log(ReportLevel.Info,tempStr[0] +" " + tempStr1[0] + " " + b);
Report.Log(ReportLevel.Info,tempStr[1] +" " + tempStr1[1] + " " + b1);
Can anyone help me with this?
Thanks,
Rekha