function pretty($x) {
var $y = $x.split(/'\s*/),
$ft = parseInt($y[0],10),
$in = Math.floor(parseFloat($y[1]));
return $ft + "'" + $in + '"';
}
P.S. Please don't give a lower grade when you can post a reply asking for further clarification on some point. Thank you for not downgrading our responses this time.
4' .5"
I was having a lot of trouble understanding this line....
$in = parseInt($y[1].trim().subs
so I broke it down....
var splitit = zheight_feet_and_inches.sp
var inchside1 = splitit[1];
var inchside2 = inchside1.trim();
var inchside3 = inchside2.substring(inchsi
var inchside4 = parseInt(inchside3);
.....and found I was always getting an NaN value in inchside4 when this was called
parseInt(inchside4) -- The value of inchside3 at this point is .5".
Can you help me figure out what I am doing wrong?
Thanks!