Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (int)
Viewing all articles
Browse latest Browse all 2

Converting a line of String to an Int

$
0
0

Hi all, I want to know if it is possible to convert a line of string to an Int for example I,m reading from a Json file and it returns the Name and Nickname of a specific selected fighter but i want to count the amount of Nicknames the fighter has to use in a For loop ...

var tableInbox = Ti.UI.createTableView({ top:'6%', objName: 'tableInbox',bottom : '12%'});
var tableInboxData = [];
var url = 'https://raw.github.com/appcelerator/Documentation-Examples/master/HTTPClient/data/json.txt'; 
var xht = Ti.Network.createHTTPClient({
        onload:  function() {
        json = JSON.parse(this.responseText);
        Task = json.fighters[ID];  //The ID is the nr of the Name selected in the Array so it returns just 1name and its Nickname 
        alert(Task);
for (var i = 0; i < Task.Nickname.length ; i++){
If I use this code it counts all the fighters nicks and returns 10 insted of just the one and I know there is only 1 nick so a for loop is not necessary but this is just for the testing other data will replace the current Json and the code will be altered Thank you for the help

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images