Skip to content

Instantly share code, notes, and snippets.

@gormster
Last active May 20, 2020 00:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gormster/acbdc30bffab6bd54e45e02605a672d5 to your computer and use it in GitHub Desktop.
Save gormster/acbdc30bffab6bd54e45e02605a672d5 to your computer and use it in GitHub Desktop.
Power Automate/Logic Apps - Split String to Characters
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"type": "String",
"metadata": {
"description": "Name of the logic app."
}
},
"logicAppLocation": {
"defaultValue": "[resourceGroup().location]",
"allowedValues": [
"eastasia",
"southeastasia",
"centralus",
"eastus",
"eastus2",
"westus",
"northcentralus",
"southcentralus",
"northeurope",
"westeurope",
"japanwest",
"japaneast",
"brazilsouth",
"australiaeast",
"australiasoutheast",
"southindia",
"centralindia",
"westindia",
"canadacentral",
"canadaeast",
"uaecentral",
"westcentralus",
"westus2",
"[resourceGroup().location]"
],
"type": "String",
"metadata": {
"description": "Location of the logic app."
}
}
},
"resources": [
{
"type": "Microsoft.Logic/workflows",
"apiVersion": "2016-06-01",
"name": "[parameters('logicAppName')]",
"location": "[parameters('logicAppLocation')]",
"properties": {
"state": "Disabled",
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"$authentication": {
"defaultValue": {},
"type": "SecureObject"
}
},
"triggers": {
"manual": {
"type": "Request",
"kind": "Button",
"inputs": {
"schema": {
"type": "object",
"properties": {
"text": {
"title": "Input",
"type": "string",
"x-ms-dynamically-added": true,
"description": "The input string to split into characters",
"x-ms-content-hint": "TEXT"
}
},
"required": [
"text"
]
}
}
}
},
"actions": {
"Init_string_to_split": {
"runAfter": {},
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "StringToSplit",
"type": "string",
"value": "@triggerBody()['text']"
}
]
}
},
"Select": {
"runAfter": {
"Init_string_to_split": [
"Succeeded"
]
},
"type": "Select",
"inputs": {
"from": "@range(0, length(variables('StringToSplit')))",
"select": "@ substring(variables('StringToSplit'), item(), 1)"
},
"description": "This is the single step to perform the split --- From: range(0, length(variables('StringToSplit'))) --- Map: substring(variables('StringToSplit'), item(), 1)"
}
}
},
"parameters": {},
"runtimeConfiguration": {
"lifetime": {
"unit": "Day",
"count": 366
},
"collections": {
"maximumItemCount": 100000
},
"performanceProfile": {
"throttles": {
"mode": "Low"
}
},
"retryPolicy": {
"type": "Exponential",
"interval": "PT5M",
"count": 2,
"minimumInterval": "PT5M",
"maximumInterval": "PT1H"
}
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment