Data.FmtBcd.StrToBcd

From RAD Studio API Documentation
Jump to: navigation, search

[–] Properties
Type: function
Visibility: public
Source:
Data.FmtBcd.pas
Data.FMTBcd.hpp
Unit: Data.FmtBcd
Parent: Data.FmtBcd

Delphi

function StrToBcd(const AValue: string): TBcd;
function StrToBcd(const AValue: string; const Format: TFormatSettings): TBcd;

C++

extern DELPHI_PACKAGE TBcd __fastcall StrToBcd(const System::UnicodeString AValue)/* overload */;

Description

Converts a string to the corresponding binary-coded decimal (BCD) value.

Use StrToBcd to convert a string into a binary-coded decimal value. The decimals and precision are inferred from the digits present in the string.

StrToBcd converts the string specified by aValue and returns the resulting BCD value. If aValue does not represent a value that can be expressed as a TBcd, StrToBcd raises an exception.

Tip: To convert a string to a Bcd value without raising an exception for invalid strings, use the Data.FmtBcd.TryStrToBcd function instead.

See Also