1. Technology

Your suggestion is on its way!

An email with a link to:

http://delphi.about.com/library/rtl/blrtlVal.htm

was emailed to:

Thanks for sharing About.com with others!

Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
 

Val

unit
System
category
string handling routines

declaration
procedure Val(const S: string; var Result; var Code: integer);

description
Converts a string to a numeric value.

S is a string-type expression; it must be a sequence of characters that form a signed real number. The Result argument can be an Integer or floating-point variable. Code is zero if the conversion is successful. If the string is invalid, the index of the offending character is stored in Code.

Val does not heed the local settings for the decimal separator.

example
var s : string;
    c,i : integer;
	
s:='1234';
Val(s,i,c);
//i=1234; //c=0

in real code
String Types in Delphi
Understanding and managing string data types in Delphi's Object Pascal. Learn about differences between Short, Long, Wide and null-terminated strings.

see also
Str,


 Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?

©2014 About.com. All rights reserved.