String to number conversion not workingHi, I have a regular expression that extracts the Year from a month_year i.e. "August_2020". However, I haven't been able to find the correct syntax to convert the character Year "cYear" to number so I can do math with it. I will appreciate any pointers. Thanks!!
Names Default To Here( 1 );
SelMonth = {"October_2020"};
cYear = (Regex Match (char(SelMonth), "\d{4}") );
//convert character year to number year
nYear = Num ("cYear"); //Scripting Guide p137
//Subtract 1 and get previous year
pYear = (nYear - 1);
//convert previous year to character
cpYear = Char ( pYear);ScriptingRe: String to number conversion not workingThe variable "SelMonth" is a JMP List( i.e. {} ), therefore the value of variable "cYear" is a list
{"2020"}
Assuming there is a reason that "SelMonth" needs to be a List, the simple solution is to reference "cYear" with a subscript to get the value
nYear = Num (cYear[1]);
Re: String to number conversion not workingAh! Yes, the first value of the list! Thanks TX,