RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
FMTBcd.StrToBcd Function

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

Pascal
function StrToBcd(const AValue: string): TBcd;
C++
TBcd StrToBcd(const AnsiString AValue);

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 TryStrToBcd function instead.
 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!