Share via


How to split string with line feed /n

Question

Saturday, October 27, 2018 11:37 AM

Hi.

I am trying to use a logic app for a integration solution. I call a service that returns a record where one field is Street. this field contains text with /n and I need that to be the delimiter to split it into three address field in the service I post to.

I am struggling with how to achieve that. Any suggestion to how to achieve that would be most appreciated.



All replies (4)

Saturday, October 27, 2018 7:30 PM ✅Answered

Hi,

You can do it like below

1. Initialise a variable of Array type outside for each like below

2. Set this variable in for each with your value like below.

@split(triggerBody()?['Street'],'/n')

3. then,in your http shape you can initialise you variable array which you used earlier like below

address1:@variables('edw')[0]

address2:@variables('edw')[1]

address3:@variables('edw')[2]

Sujith


Sunday, November 11, 2018 6:55 PM ✅Answered | 1 vote

Hi ,

I think the Logic apps has a Problem with "\.

i found a work around for this issue.

Go to Code View,

you will find that LIke this

@split(triggerBody()?['Street'],'\\n')

Try to just Change it to, it should work.

@split(triggerBody()?['Street'],'\n')

Sujith


Monday, October 29, 2018 6:09 PM

Hi AlwaysLearning2018 - any updates on this? Please let us know if we can help :)

 


Sunday, November 11, 2018 2:28 PM

Hi again.

Sorry for the late reply.

I simply cannot get it to work. It will not recognize the \n as a delimiter. Even tried with convert to string first.



split(string(triggerBody()?['Street']),'\n')

Result:

Change split to 'ee' delimiter works:

split(string(triggerBody()?['Street']),'ee')