Get the last string
Question

Hello All,

i have an entity which includes a column with strings. Every string may have the below format

XXXX XXXX    

XXXX XXXX XXXX

XXXX XXXX XXXX XXXX

As you see the content separated with space between them. My request is how to get the last part of every string; this part which exists after the last space(marked with red)

Any advise/suggestion?

Solution

Hey @George M 

You can get using the String Split function

or using the subtr function 

Substr(inputString,Index(inputString," ",searchFromEnd:True),Length(inputString))

To be more complete, you can have a look at this component but I think you can see the logic working on the example i shared.

https://www.outsystems.com/forge/component-overview/9331/split-string

Regards,

Márcio


stringsplit.oml

mvp_badge
MVP

Hi George,

You could do that with an advanced SQL using the SQL STRING_SPLIT function.

https://docs.microsoft.com/en-us/sql/t-sql/functions/string-split-transact-sql

That way you do not have to use a for each to integrate your aggregate result list.

Regards,

Daniel

Thank you for your replies.

If i want to get only the letters from the string and not the numbers?

XXXX XXXX    

XXXX XXXX XXXX

XXXX XXXX XXXX XXXX

Below i have marked with green only the letter words (with black are the numbers)

mvp_badge
MVP

Well that is a complete (new) question than your original question right?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.