How to split a string in Inno Setup

srikanth1267

How can I split a string in Inno Setup?
Is there any special function in Inno Setup to split the string?

I want to get the following from the string '11.2.0.16':

tokens: array of string = ('11', '0', '2', '16');

Thanks in advance!

cezarlamann

I've been looking for the same thing today...

This one works just fine on Inno Setup Scripts. Paste this excerpt inside your script before the procedure/function which will call this "split" procedure.

You can also modify this onto a function, if you desire...

procedure Explode(var Dest: TArrayOfString; Text: String; Separator: String);
var
  i, p: Integer;
begin
  i := 0;
  repeat
    SetArrayLength(Dest, i+1);
    p := Pos(Separator,Text);
    if p > 0 then begin
      Dest[i] := Copy(Text, 1, p-1);
      Text := Copy(Text, p + Length(Separator), Length(Text));
      i := i + 1;
    end else begin
      Dest[i] := Text;
      Text := '';
    end;
  until Length(Text)=0;
end;

procedure Whatever();
var 
  str: String;
  strArray: TArrayOfString;
  i: Integer;
begin
  Explode(strArray,str,'.');
  for i:=0 to GetArrayLength(strArray)-1 do begin
    { do something }
  end;
end;

Taken from here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to parse a JSON string in Inno Setup?

From Dev

Inno setup: how to replace a string in XML file?

From Dev

Convert Boolean to String with Inno Setup

From Dev

How to override functions in Inno Setup?

From Dev

how to refresh a page in inno setup

From Dev

How to extract a Inno Setup Installer

From Dev

Inno setup - how to change version in the setup hover?

From Dev

Inno Setup: Exec can't read string?

From Dev

Convert Single data type to string in inno setup

From Dev

Inno Setup convert string in array to boolean

From Dev

inno setup - Delete arbitrary substring from a string

From Dev

How do I return a string from DLL to Inno Setup Pascal Script

From Dev

How to delete a nonempty folder in inno setup

From Dev

How to get the full computer name in Inno Setup

From Dev

How to catch OleObject exception in Inno Setup?

From Dev

How to create two LicenseFile pages in Inno Setup

From Dev

How to call "npm install" from Inno Setup?

From Dev

How to support thousands of files using Inno Setup?

From Dev

How to Translate texts contained in MsgBox in Inno Setup?

From Dev

How to check for presence of a directory in Inno Setup preprocessor?

From Dev

How to do a silent install of mysql in inno setup?

From Dev

How to use a Pascal variable in Inno Setup?

From Dev

Inno Setup: How to change background color

From Dev

Inno Setup: how to use {app} in InitializeWizard?

From Dev

How to use special character in Inno Setup?

From Dev

How to check if port is usable in Inno Setup?

From Dev

How to comment a block of statements in Inno Setup?

From Dev

How to implement MAKELPARAM for SendMessage function in Inno setup?

From Dev

Inno - how to address the setup window title?

Related Related

HotTag

Archive