i want to get the last two words in a sentence for example “this is a test result.” and i want to get in the output is “test result”. how can i achieve this? i’ve been trying for days but i can’t seem to find any solution as the sentence changes it’s length dynamically. is there any way to achieve this goal? i’m a newbie so i still don’t know a lot.
myString = "this is a test result."
outString = myString.Split(" “c)(myString.Split(” “c).Count-2)+” “+myString.Split(” “c)(myString.Split(” "c).Count-1)
Can you send what you using in the two assign activity
hi. i’m doing it inside a for each row. i have to find the address and put remarks if it in the category of first array of strings, or in the second one or in the third one.
City = row(“AREA”).ToString.Trim.Split(" “c)(row(“AREA”).ToString.Trim.Split(” “c).Count-2)+” “+row(“AREA”).ToString.Trim.Split(” “c)(row(“AREA”).ToString.Trim.Split(” "c).Count-1)
Jothy Prasanth M
Make sure that you have the value in row(“AREA”).ToString
If possible can you share the workflow so that i can look into it.
The error is from the below data
I am splitting the word by space and expecting more then one word in a sentence but in the lase two data only one word is there in a sentence that’y why it’s throwing the error.
remove the last two row and try to run
yeah it works but why does my for each row run only once? it stopped reading after reading the first row.
why is that?
i am checking if value city is inside the array values and write which array value are they in. but now my for each loop only read the first row and won’t read the following rows. could there be a problem in my condition?
@Tammy1998 Based on the Question, You want to get the Last Two words in a Sentence, but what if there is only a Single word in the Sentence, In that Case what should be your Output?
i will put a write cell activity saying N/A or no action will be made and skip
hi thanks for the tip… it works but it only read the first row and it will stop running. i wonder what could be the problem…
@Tammy1998 What Should be the output according to you?
hi. the output was correct. but i want to check for each row of the data whether the row is found in ncr or luzon or vizmin. the problem is it doesn’t check the for each row…
@Tammy1998 Actually the For Each Row is Looping through Each of the rows, But the Condition matches only for One row.I did a Little Debugging to find that out. But Since it Contains many records I didn’t try out with all the Records, Please Debug for Each records and check.
config area breaking.xaml (24.7 KB)