ScriptCore3.StrToInt

From Soldat Community Wiki
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;