Skip to content

Commit bfc1858

Browse files
committed
add split string invocable class
1 parent a791d17 commit bfc1858

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
public with sharing class SplitStringInvocable {
2+
@InvocableMethod(
3+
label='Split String'
4+
description='Given a string and a delimiter, return a collection of strings'
5+
)
6+
public static List<List<String>> SplitStringInvocable(
7+
List<Request> requests
8+
) {
9+
List<List<String>> output = new List<List<String>>();
10+
for (Request req : requests) {
11+
output.add(req.inputText.split(req.delimiter));
12+
}
13+
return output;
14+
}
15+
16+
public class Request {
17+
@InvocableVariable(required=true label='Input Text')
18+
public String inputText;
19+
@InvocableVariable(
20+
required=true
21+
label='Separator'
22+
description='The delimiter that separates blocks of text inside your Input Text.'
23+
)
24+
public String delimiter = ';';
25+
}
26+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<apiVersion>59.0</apiVersion>
4+
<status>Active</status>
5+
</ApexClass>

0 commit comments

Comments
 (0)