Separate values from array - iphone

This string response i am getting from server.
2001,wooza,0420224346,J Wratt ,+61417697070,2013-55-1803-55-54.jpg,No<br />2002,wooza,0420224346,J Wratt ,+61417697070,2013-56-1803-56-17.jpg,No<br />2003,testing,9894698946,ggh hjj,9894598945,2013-11-1811-11-40.jpg,Yes<br />
I separate each record through "br" and stored it in a array.How do i access (2013-55-1803-55-54.jpg) value from array.

You can get through objectAtIndex method.
Alrenatively its better you keep the all the related data of your custom class and storing that in array.
Most of the times you will need more than one value during display. In that case, just get the object from array and show related info through object reference.

Take comma separated strings from an intended element in a different array and use NSPredicate to get the string containing .jpg in it.

Related

Changing data types in an array in Redshift

I have the following string: WhatsappAutoResponse+landing+redirectFrom1206+redirectFrom1352
My goal is to extract the numbers after the substrings +redirectfrom and store that in an array, like this: [1206, 1352]
I managed to do the following:
The function split_to_array separates the string in parts. The numbers I'm looking for are the 2nd and 3rd elements in the array. I don't want the first element.
select split_to_array('WhatsappAutoResponse+landing+redirectFrom1206+redirectFrom1352', '+redirectFrom');
Result: ["WhatsappAutoResponse+landing","1206","1352"]
I get rid of the 1st element using the subarray function:
select subarray(split_to_array('WhatsappAutoResponse+landing+redirectFrom1206+redirectFrom1352', '+redirectFrom'),1,2);
Result: ["1206","1352"]
Almost there! However, I'm getting an array of strings, but I need an array of integers. I couldn't find a way to cast values inside an array, like in array::int
Is there any way to solve this?

Swift string with key-value, is this format standard ? How can I get it as a dictionary?

I work with an array of string, each string var is a coded object.
I want to decode the object, when I print a string var I get something structured like that :
"firstName=\"Elliot\" lastName=\"Alderson\" gender=\"male\" age=\"33\",some description I also need to get"
Is that a standard format to store key value properties ? I can't find anything on internet. The keys are always the same so that's not a big deal to get theses values as a dictionary but I would like to know if there is like a best practice method to get theses data instead of just searching for each key and then reach value from the first quote to the second one (for each value)
Because my file is 30000 lines so I better choose the more optimized way.
Thanks !

Is PapaParse adding an empty string to the end of its data array?

Papa Parse seems wise, but I think he might be giving me null. I'm just:
Papa.parse(countries);
Where countries is a string containing the XMLHttpRequest of the countries csv file from a timezone database here:
https://timezonedb.com/download
But Papa Parse seems to have added an empty array to the end of it's data array. So when I'm searching and sorting through the array, that one empty guy at the end is giving me troubles. I can write around it but it's not ideal, and I thought Papa Parse was supposed to make those kind of csv parsing problems go away. Am I Parsing wrong?
Here is the end of the PapaParsed Array in console:
You need to use skipEmptyLines: true in parse config. For example:
Papa.parse(this.csvData, {skipEmptyLines: true,})
it was adding empty line to my iteration as well. i decided to skip it by doing loop:
for(let i=0;i<data.length -1;i++){
We can also use below syntax to remove empty lines from the record.
For example, in order to remove empty values from header, we can use the below code snippet.
headers.filter(Boolean);

Web services with JSON Parsing

In my app Web services are created in dot net and i am consuming those and I am getting response.In that all the fields like company,type,location everything are strings and there is no problem with this..And there is one more field called Exhibit number actually it is a Integer but they are created as string only.While I am displaying this it is showing zero instead of that number.. Here is my code...
//Storing into Array
[SurveyFilesArray addObject:[NSDictionary dictionaryWithObjectsAndKeys:[dic objectForKey:#"FileName"],#"FileName",[dic objectForKey:#"ExibhitNumber"],#"ExhibitNumber",[dic objectForKey:#"Description"],#"Description",[dic objectForKey:#"FileQuality"],#"FileQuality",nil]];
//Retrieving from Array..
NSLog(#"???%#???",[NSString stringWithFormat:#"%d",[[[SurveyFilesArray objectAtIndex:indexPath.row]objectForKey:#"ExibhitNumber"]intValue]]);
NSLog(#"%d",[[[SurveyFilesArray objectAtIndex:indexPath.row]objectForKey:#"ExibhitNumber"]intValue]);
You have typos in your code.
In the order of your code:
Ex-ib-hit-Number
Ex-hib-it-Number
These are 2 different strings.
In your example code you save it correctly written as Ex-hib-it. But you try to access it with ex-ib-hit afterwards. This cannot work.

iphone sdk - how do i do this if else checking logic. checking an NSMutableArray for a possible value against parsed xml

EDIT*
hi guys , lets say i have an array with 5 Strings = "1","2","3","4","5".
Im also doing parsing of xml. So how do i check whether a parse xml value is the same value of either one of the objects IN the array?
solved * i put them in a for loop to, looping through each array.value and making a root (if else) that checks whether the value in the array is equal to the parsed xml value