-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelease_89.bal
44 lines (35 loc) · 833 Bytes
/
release_89.bal
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
import ballerina.lang.strings;
struct Person {
string first_name;
string last_name;
int age;
Address address;
}
struct Address {
string number;
string street;
string city;
}
struct Employee {
string name;
string location;
Address address;
int category;
}
function getFirstName (string name) (string firstName) {
string names = strings:split(name," ");
return names[0];
}
function main (string[] args) {
int category = 1;
string abc;
string ret;
Person p = {first_name: "John",last_name: "Doe",age: 30,city: "London"};
Employee e = {};
transform {
e.category = category;
e.address.number = p.address.number;
e.name = getFirstName(strings:toLowerCase(p.first_name));
ret = strings:toLowerCase(abc);
}
}