Difference between revisions of "ScriptCore3.StrToInt"

From Soldat Community Wiki
Jump to: navigation, search
(new page)
 
m (Example)
 
Line 26: Line 26:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
[[Category:ScriptCore 3]][[Category:Functions]]
+
[[Category:Functions]]

Latest revision as of 17:28, 12 August 2013

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;