Energy Base Standard

This document describes standard behavior for Energy.Base helpers.

Text

Trim

Remove all leading and trailing whitespace characters: space, tab, line feed, carriage return, vertical tab, form feed, and null.

IsInteger

Check if a value represents an integer number.

IsNumber

Check if a value represents a number, including scientific notation.

Cast

StringToBool

Convert text to a boolean value using localized rules.

StringToInteger

Convert text to a signed 32-bit integer without throwing exceptions. Leading and trailing whitespace is ignored. Returns 0 on failure.

StringToLong

Convert text to a signed 64-bit integer without throwing exceptions. Returns 0 on failure.

StringToDouble

Convert text to a double. Accepts both dot and comma decimal separators.

DoubleToString

Convert a double to a culture-invariant string.

Collections

StringDictionary

  • Lookup is case-insensitive by default.

  • Returns default(T) for missing keys.

Array

  • All operations are thread-safe.

  • Count can be set to grow or shrink the array.

Date and time

Clock

  • Truncate and Floor return a DateTime with the specified precision.

  • Leap year checks follow the Gregorian calendar.

Logging

Log.Entry

  • Entries have a Time, Level, and Message.

  • Targets write entries to their destination.