ScriptCore3.StrToInt

From Soldat Community Wiki
Revision as of 17:28, 12 August 2013 by Mighty (talk | contribs) (Example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
function StrToInt(Text: String): Integer
 Text: string that is to be converted into a number
 Result: conversion result

Description

This converts a string into a number.

Example

var
  MyStr: string;
  MyInt: integer;
begin
  MyStr := '1';
  MyInt := StrToInt(MyStr); // this will work

  MyStr := '-1';
  MyInt := StrToInt(MyStr); // this will work

  MyStr := '1.00';
  MyInt := StrToInt(MyStr); // this will NOT work

  MyStr := '1ab2c';
  MyInt := StrToInt(MyStr); // this will NOT work
end;