-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDotNetWrappers.al
More file actions
57 lines (49 loc) · 1.4 KB
/
DotNetWrappers.al
File metadata and controls
57 lines (49 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
codeunit 50101 DotNetWrappers
{
trigger OnRun()
begin
TextDemo;
ListDemo;
end;
procedure TextDemo();
var
myText : Text;
myTextBuilder : TextBuilder;
begin
myTextBuilder.AppendLine('We can append new lines');
myTextBuilder.Append('... or just characters to the current line');
myTextBuilder.Replace('Text can also be','replaced');
myText := myTextBuilder.ToText();
myText := myText.ToUpper();
Message(myText);
end;
procedure ListDemo()
var
customerNames : List of [Text];
begin
customerNames.Add('John');
if customerNames.Contains('John') then
Message('John is in the list.');
Message('Name at index 1: ' + customerNames.Get(1));
end;
procedure CountCharactersInCustomerName(customerName : Text; var counter : Dictionary of [Char, Integer])
var
i : Integer;
c : Integer;
begin
Clear(counter);
for i := 1 to StrLen(customerName) do begin
if counter.Get(customerName[i],c) then
counter.Set(customerName[i], c + 1)
else
counter.Add(customerName[i], 1);
end;
end;
procedure PrintCustomerNames(customerNames : List of [Text])
var
name : text;
begin
foreach name in customerNames do
Message(name);
end;
}