blob: c096cb8a6d9cbe9a353bbb0f8bc66d0f6303b1e1 [file] [log] [blame]
/* Copyright (C) 2011 Jan Källman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* The GNU Lesser General Public License can be viewed at http://www.opensource.org/licenses/lgpl-license.php
* If you unfamiliar with this license or have questions about it, here is an http://www.gnu.org/licenses/gpl-faq.html
*
* All code and executables are provided "as is" with no warranty either express or implied.
* The author accepts no liability for any damage or loss of business that this product may cause.
*
* Code change notes:
*
* Author Change Date
*******************************************************************************
* Mats Alm Added 2013-12-03
*******************************************************************************/
using System;
using System.Collections.Frozen;
using System.Collections.Generic;
namespace EpplusFormulaParser;
internal static class FunctionRepository {
private static readonly FrozenSet<string> _functions = new HashSet<string>(
StringComparer.InvariantCultureIgnoreCase) {
// Text
"len",
"lower",
"upper",
"left",
"right",
"mid",
"replace",
"rept",
"substitute",
"concatenate",
"char",
"exact",
"find",
"fixed",
"proper",
"text",
"t",
"hyperlink",
// Numbers
"int",
// Math
"abs",
"asin",
"asinh",
"cos",
"cosh",
"power",
"sign",
"sqrt",
"sqrtpi",
"pi",
"product",
"ceiling",
"count",
"counta",
"countblank",
"countif",
"countifs",
"fact",
"floor",
"sin",
"sinh",
"sum",
"sumif",
"sumifs",
"sumproduct",
"sumsq",
"stdev",
"stdevp",
"stdev.s",
"stdev.p",
"subtotal",
"exp",
"log",
"log10",
"ln",
"max",
"maxa",
"median",
"min",
"mina",
"mod",
"average",
"averagea",
"averageif",
"averageifs",
"round",
"rounddown",
"roundup",
"rand",
"randbetween",
"quotient",
"trunc",
"tan",
"tanh",
"atan",
"atan2",
"atanh",
"acos",
"acosh",
"var",
"varp",
"large",
"small",
"degrees",
// Information
"isblank",
"isnumber",
"istext",
"isnontext",
"iserror",
"iserr",
"error.type",
"iseven",
"isodd",
"islogical",
"isna",
"na",
"n",
// Logical
"if",
"iferror",
"ifna",
"not",
"and",
"or",
"true",
"false",
// Reference and lookup
"address",
"hlookup",
"vlookup",
"lookup",
"match",
"row",
"rows",
"column",
"columns",
"choose",
"index",
"indirect",
"offset",
// Date
"date",
"today",
"now",
"day",
"month",
"year",
"time",
"hour",
"minute",
"second",
"weeknum",
"weekday",
"days360",
"yearfrac",
"edate",
"eomonth",
"isoweeknum",
"workday",
// Database
"dget",
"dcount",
"dcounta",
"dmax",
"dmin",
"dsum",
"daverage",
"dvar",
"dvarp",
}.ToFrozenSet();
public static bool IsFunctionName(string name) {
return _functions.Contains(name);
}
}