Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

GETDTOVAL()

GetDToVal(cDtoVal) -> nRet

Extracts a number from a string with mixed characters.

GETDTOVAL()AdvPL
01 · OVERVIEW

Overview

The reference describes digit extraction with decimal-point handling. Characters such as slashes are discarded and strings without digits return zero. Conversion does not consider negative numbers. Despite its name it does not convert dates, nor validate monetary or document-number formats. (Sources: refs. 1–1.)

02 · SYNTAX

Syntax

GetDToVal(cDtoVal) -> nRet

Parameters

cDtoVal
CharacterRequired

Text containing a numeric value.

Return value

Extracted number.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed466()
    // Permissive extraction, not input validation.
    ConOut(cValToChar(GetDToVal("1/2/3")))
    ConOut(cValToChar(GetDToVal("abc")))
Return Nil
Expected result

Expected numeric results: 123 and 0. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Validate format beforehand when invalid characters must cause an error.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. GetDToVal. TDN. Accessed on 2026-10-27.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha