Skip to content

Utils class

Represents different type conversion functions and other useful procedures

public static class Korzh.EasyQuery.Utils
TypeNameDescription
RegexMacroRegexThe Regex object which matches a macro value.
TypeNameDescription
StringInternalDateFormatGets the internal date format (yyyy-MM-dd).
StringInternalTimeFormatGets the internal time format (HH:mm:ss).
TypeNameDescription
BooleanAreCompatibleTypes(DataType type1, DataType type2)Returns true if type1 can be converted to type2.
StringComposeKey(String parent, String child)Composes the key (for attributes, entities, etc). Returns “parent.key” if both parent and key are not empty/null
BooleanContainsNonAscii(String s)Checks string for inclusion of non-ASCII symbols.
DataKindDataKindByName(String kindName)Gets the DataKind value by its text representation.
StringDateTimeToInternalFormat(DateTime dt, DataType dataType)Converts DateTime value to its string representation in internal format (yyyy-MM-dd).
StringDateTimeToUserFormat(DateTime dt, DataType dataType)Converts DateTime value to its string representation in current system format.
StringFormatDateTimeValue(String val, String format, DataType dataType, Int32 timezoneOffset = 0)Converts the date/time passed in internal format used in EasyQuery library (yyyy-MM-dd HH:mm:ss by default) to some other date/time format
CultureInfoGetCurrentCulture()Returns current culture
CultureInfoGetCurrentUICulture()Returns current UI culture
DataTypeGetDataTypeBySystemType(Type systemType)Gets the type of the data type by system type.
StringGetDateTimeInternalFormat(DataType dataType, Boolean shortTime = False)Gets the format used for internal textual representation of date/time values. EasyQuery uses “yyyy-MM-dd” format.
StringGetElementContentAsString(XmlReader reader)Reads the content of current XML element (as string)
IList<Int32>GetEnumValues(Type oEnumType)Gets all values of the enum.
IFormatProviderGetInternalFormatProvider()Gets the internal format provider. This provider defines the format used to store date/time and numeric values internally and it saved queries
DateTimeGetSpecialDateByName(String name, Boolean utc)Gets the actual date value by its macro name (like “Today”, “FirstDayOfMonth”, etc).
DateTimeGetSpecialDateByNameEx(String name, Boolean utc, DataType& dt)Gets the actual date value by its macro name (like “Today”, “FirstDayOfMonth”, etc).
DateTimeGetSpecialDateValue(SpecialDateTime sdt, Boolean utc)Gets the value of some special date (like Today or FirstDayOfYear) by its enum definition.
DateTimeGetSpecialDateValueEx(SpecialDateTime sdt, Boolean utc, DataType& dt)Gets the value of some special date (like Today or FirstDayOfYear) by its enum definition.
TypeGetSystemTypeByDataType(DataType type)Gets the system type by data type.
TypeGetSystemTypeByDataType(DataType dtype, Type defaultType)Gets the system type by data type.
DateTimeInternalFormatToDateTime(String val, DataType dataType)Convert string representation in internal format to DateTime value.
BooleanIsStrNullOrEmpty(String s)Determines whether specified string is null or empty.
BooleanMatchMacro(String s, String& macroName)Matches the macro in the input string. Returns the name of the macro in “out” parameter if the match was successful
BooleanMoveToAttribute(XmlReader reader, String attrName)Moves current position of XmlReader into specified attribute.
DateTimeOldFormatToDateTime(String val)Convert string representation in old format to DateTime value.
BooleanSafeParseBool(String value, Boolean defValue = False)Converts the string representation of a boolean value. This method does not throw an exception. Instead - it returns some pre-defined value for unsuccessful conversions.
Int32SafeParseInt(String s, Int32 defValue = 0)Converts the string representation of a number to its 32-bit signed integer equivalent. This method does not throw an exception. Instead - it returns some pre-defined value for unsuccessful conversions.
StringStrToIdentifier(String s)Converts any string to an identifier (changes all symbols like ’.’ ’;’ ’?’ etc to ’_‘)
BooleanTextEq(String s1, String s2)Provides case-insensitive string comparision
BooleanTryGetSpecialDate(String macroName, Boolean useUtcTime, DateTime& dateVal, DataType& dt)Gets the actual date value by its macro name (like “Today”, “FirstDayOfMonth”, etc). This function returns false if the macro name is not recoginized.