this is not working on ANDROID: var h2LNAME = 'ZZ'; h2LNAME = h2LNAME.substring(0,1);
whats the matter with it.. there is a runtime error. Type error: cannot call method "substring" of null... but works on iPHNONE
3 Answers
Accepted Answer
Hi Vincent
It returns OK for me on Android SDK 2.2, Titanium SDK 1.4.X, using the following code:
var win = Ti.UI.createWindow({ backgroundColor:'red', exitOnClose:true, layout:'vertical' }); var h2LNAME = 'ZZ'; h2LNAME = h2LNAME.substring(0,1); var label = Ti.UI.createLabel({ backgroundColor:'blue', color:'white', text:'substring returns : '+h2LNAME, textAlign:'center', top:10, height:60, width:200 }); win.add(label); win.open();See this screenshot
substring is not working with text field value Plz help me out...
var txtVal= parseInt(txtC61.value) var resultC6= txtVal + 1234; resultC6= resultC6.substring(0,2) Label6.text='Value is '+ resultC6; }
I took the same code, and put it in a new project.. and now it works... don't know what to say. But its working for me now as well.
Your Answer
Think you can help? Login to answer this question!