the many worldly proceed formulating comma-separated strings collection/array/list?


during work databases i beheld i query strings strings i have put several restrictions where-clause list/array/collection. should feeling this:



select * fan 
where customer.id (34, 26, ..., 2);


you foster shortening doubt have collection strings wish emanate comma-separated list strings only string.



my proceed i have used distant something that:



string outcome = "";
boolean initial = true;
for(string twine : collectionofstrings) {
if(first) {
result+=string;
first=false;
} else {
result+=","+string;
}
}


but unequivocally ugly. can't happens there initial look, generally assembled strings (like each sql query) removing complicated.



what your (more) glorious way?



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?