@odoo/o-spreadsheet
Version:
A spreadsheet component
26 lines (25 loc) • 1.17 kB
TypeScript
import { Locale } from "../types/locale";
/**
* This function returns a regexp that is supposed to be as close as possible as the numberRegexp,
* but its purpose is to be used by the tokenizer.
*
* - it tolerates extra characters at the end. This is useful because the tokenizer
* only needs to find the number at the start of a string
* - it does not support % symbol, in formulas % is an operator
*/
export declare const getFormulaNumberRegex: (decimalSeparator: string) => RegExp;
/**
* Return true if the argument is a "number string".
*
* Note that "" (empty string) does not count as a number string
*/
export declare function isNumber(value: string | undefined, locale: Locale): boolean;
/**
* Convert a string into a number. It assumes that the string actually represents
* a number (as determined by the isNumber function)
*
* Note that it accepts "" (empty string), even though it does not count as a
* number from the point of view of the isNumber function.
*/
export declare function parseNumber(str: string, locale: Locale): number;
export declare function percentile(values: number[], percent: number, isInclusive: boolean): number;