I tried to convert the function below from Delphi to B4A, but I'm stuck in ths part of the code:

What is an how to use the equivalent commands (chr, xor, ord) in B4A?

This is what the Delphi commands do:

The

The

The

Any help are welcome. Thanks.

B4X:

` NewText := NewText + Chr((Ord(Key(x)) xor Ord(Text(y))));`

B4X:

```
function ShuffleText(Text, Key: String): String;
var
x, y: Integer;
NewText: String;
begin
For x := 1 To Length(Key) Do
begin
NewText := '';
For y := 1 To Length(Text) Do
NewText := NewText + Chr((Ord(Key[x]) xor Ord(Text[y])));
Text := NewText;
end;
Result := Text;
end;
```

B4X:

```
Sub ShuffleText(Text As String, Key As String) As String
Dim x, y As Int
Dim NewText As String
For x := 0 To Key.Length - 1
NewText = ""
For y = 0 To Text.Length - 1
NewText = NewText + Chr((Ord(Key(x)) xor Ord(Text(y))));
Next
Text = NewText
Next
Return Text
End Sub
```

The

**chr**function converts an IntValue integer into either an AnsiChar or WideChar as appropriate.The

**ord**function returns an integer value for any ordinal type Arg.The

**xor**keyword is used to perform a logical or boolean 'Exclusive-or' of two logical values. If they are different, then the result is true.Any help are welcome. Thanks.

Last edited: