The below code can be executed in Anonymous window.I I have seen this code working before.
I am expecting qProdList to return exact number of records that i pass in the set "st".I am passing 18 items in st. ButBut the number of product records returnreturned by qProdList is always 10 records.
I have verified all these 18 items in the database, and all are present. only post iI am applying string operation itit results in 10 items.
Please advice what could be the reason string operation is behaving inconsitentinconsistent in apex ?
set<string> st = new set<String>{'A,'B','C','D','E','F','G,'S,'Q','N','M','Y','O','P,'J,'K,'I','H'H'};
system.debug('st : ' + st.size() + '--' + st);
string b = string.valueof(st).split('[{}]')[1];
system.debug('b : ' + b);
string qProd = 'select isActive,ProductCode from Product2 where isActive = true and ProductCode IN (\''+ b.replaceAll('\\, ','\',\'')+'\')';
system.debug('qProd : + ' + qProd);
list<Product2> qProdList = Database.query(qProd);
system.debug(' -- qProdList -- : ' + qProdList.size());
system.debug(' -- qProdList -- : ' + qProdList.size());