Skip to main content
2 of 3
added 112 characters in body
Santanu Boral
  • 36.2k
  • 8
  • 45
  • 72

i need to split larger set list into samller chunks

i have a requirement, where i am holding list(1000) of email address into one set, and with that i need to split them in to 100 in each sublist and make queryString need to perform sosl query.

 set<integer> nms= new set<integer>();
string str;
integer setindex=0;
for(integer i=0;i<100;i++)
{
    nms.add(i);
}

system.debug('set==>'+nms.size());

set<integer> temp= new set<integer>();
for(integer i=0;i<nms.size()/10;i++)
{
    
    for(integer j=0;j<30;j++ )
    { 
        str=str +string.valueOf(j)+' or ';
        setindex++;
        //sosl
        
    }
    
   if(setindex== nms.size())
       break;
   system.debug('set==>'+str);
    
}

can any one help me fix this issue.

Thanks

Vijay
  • 33
  • 1
  • 5