Gość: xxxxxxx IP: *.neoplus.adsl.tpnet.pl 02.04.05, 18:00 mam pytanie czy ktos zna komede która by znak przerobila na liczbe. np znak '2' na liczbe 2 i tak ze wszystkimi liczbami Link Zgłoś Obserwuj wątek
user0001 Re: turbo pascal 02.04.05, 18:37 Val Calculate numerical value of a string. Declaration Source position: system.fpd line 49 procedure Val( const S: String; var V; var Code: Word ); Description Val converts the value represented in the string S to a numerical value, and stores this value in the variable V, which can be of type Longint, Real and Byte. If the conversion isn't succesfull, then the parameter Code contains the index of the character in S which prevented the conversion. The string S is allowed to contain spaces in the beginning. The string S can contain a number in decimal, hexadecimal, binary or octal format, as described in the language reference. Errors If the conversion doesn't succeed, the value of Code indicates the position where the conversion went wrong. See also Str Convert a numerical value to a string. Example Program Example74; { Program to demonstrate the Val function. } Var I, Code : Integer; begin Val (ParamStr (1),I,Code); If Code<>0 then Writeln ('Error at position ',code,' : ',Paramstr(1)[Code]) else Writeln ('Value : ',I); end. Link Zgłoś