I have a list of strings and i want to get a specific strings in a range between CHECK # 259395 and SUB-TOOTAL..
List<String> item = [
'CHECK # 259395',
'2 MINERAL WATER',
'1 HOT CHOCOLATE',
'1 TURKISH COFFEE DOUBLE',
'1 HEALTIHY HOSE',
'1 GUM CINNAMON SHISHA',
'SUB-TOOTAL'
];
I just want to display any item between 'CHECK # 259395' and 'SUB-TOOTAL'...
How can i achieve this ?
CodePudding user response:
you could do this:
var result = item.sublist(item.indexOf('CHECK # 259395') 1, item.indexOf('SUB-TOOTAL'));
CodePudding user response:
print(item[index]);
in index place which one u want like item[2] will print this '1 HOT CHOCOLATE',
CodePudding user response:
you can easily get like this
item[0]= 'CHECK # 259395',
item[item.length]= 'SUB-TOOTAL',