During one of customization scenario, I have come across to field which contains comma separated values. In C# and VB.net string.split method return into array of string. But in X++ split method return list. Following simple tip helps me to check that my required value exists in comma separated value.
public boolean getValidateStudentName(String50 _splitString)
{
List strlist=new List(Types::String);
ListIterator iterator;
str _Value;
boolean _NotFound=boolean::true;
;
strlist=strSplit(_splitString,”,”);
iterator = new ListIterator(strlist);
while(iterator.more())
{
_Value =iterator.value();
if (_Value ==”Ali”)
{
_NotFound=boolean::false;
}
if (_Value ==”Raza”)
{
_NotFound=boolean::false;
}
if (_Value ==”Zaidi”)
{
_NotFound=boolean::false;
}
if (_Value ==”Lahore”)
{
_NotFound=boolean::false;
}
if (_Value ==”Pakistan”)
{
_NotFound=boolean::false;
}
iterator.next();
}
return _NotFound;
}