Home > Back-end >  I want to control the content of the Edit must be negative
I want to control the content of the Edit must be negative

Time:10-18

I want to achieve the effect of is, no matter in the EDIT input is positive or negative, and click save, all give him turned negative,
For example, the input is 500, click save, is - 500

CodePudding user response:

This is a mathematical subject,
Judgment, greater than zero, is multiplied by 1, or add a minus sign,

CodePudding user response:

String turn numeric types, then take the absolute value, and finally the not, such as:
A double value:=- abs (StrToFloatDef (edtInput. Text, 0))
  • Related