
4,381 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How do I determine if a string is numeric in Office Scripts if the string cannot have any letters in it? For example, 'a1234' should not be a number. The Number methods like parsefloat, parseInt, IsInteger, and isNan don't help because they accept strings that have any numbers in them when wrapped in Number (Number(value) or +value) or don't accept strings.
I show that when the string 'a1234' is passed into Number.IsInteger(), the value is false:
function main(workbook: ExcelScript.Workbook){
let str: string = "a1234"
console.log(Number.isInteger(str)) //false
}
Is this what you were expecting? If not, what were you expecting? Or what are you trying to achieve?