Skip to main content

Check if a string is an octal number

JavaScript version

const isOctal = (str) => /^(0o)?[0-7]+$/i.test(str);

TypeScript version

const isOctal = (str: string): boolean => /^(0o)?[0-7]+$/i.test(str);

Comments