View Single Post
  #11  
Old 01-18-2014, 07:27 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
HTML Code:
this.fullnumber = 482; 
this.digitone = this.fullnumber.charat(0);
this.digittwo = this.fullnumber.charat(1);
this.digitthree = this.fullnumber.charat(2);
For a function

HTML Code:
function onCreated() {
  this.number = 2663;
  echo( this.getNumbersAsArray(this.number) ); //returns {2, 6, 6, 3}
  echo( this.getNumber(2, this.number)); //returns 6
}

function getNumbersAsArray(number) {
  temp.ret = {};
  for (temp.i = temp.number.length(); temp.i > 0; temp.i--;)
    temp.ret.insert(0, temp.number.charat(temp.i - 1));
  return temp.ret;
}

function getNumber(index, number) {
  return temp.number.charat(temp.index);
}
__________________
Reply With Quote