Skip to content

olo_base_pkg_string

Back to Entity List

Status Information

VHDL Source: olo_base_pkg_string

Description

This package contains useful string-related functions.

Definitions

None

Functions

Case Conversion

Convert a string to upper or lower case.

function toUpper (a : in string) return string;
function toLower (a : in string) return string;

Case Insensitive Comparison

Compare two strings case insensitive. Leading and trailing whitespaces are ignored (both strings are trimmed before comparison).

function compareNoCase (
    a : in string;
    b : in string) return boolean;

Trim Whitespaces

Trip white-spaces at the beginning and the end of a string.

function trim (a : in string) return string;

Parse Hex-String to std_logic_vector

Parse a hex-string to std_logic_vector.

function hex2StdLogicVector (
    a         : in string;
    bits      : in natural;
    hasPrefix : in boolean := false) return std_logic_vector;

a is the string to parse, bits the width of the resulting vector.

hasPrefix defines whether the string has a 0x prefix (e.g. "0xABCD") or not (e.g. "ABCD").

Count Character Occurrences

Count how often a character occurs in a string.

function countOccurence (
    a : in string;
    c : in character) return natural;

Error Message

Format a standardized error message string from an entity name and a message. The result has the format "<name> - <message>".

function errorMessage(
    name    : in string;
    message : in string
) return string;