Hello

1.I have a String likes "#0000003#" ,I want to split it to " "+ 0000003.

2.So I try to use String_Split to split "#" in the string.

3.But after split the String it looks like " " + 0000003 + " ", I don't need  the " " in the end of the List .

What can I do? Thank you very much.



Solution

Hey Albert,

String_Split alone won't do exactly what you need. You can either process the # symbols in a loop and decide how to handle the last one, or you can continue using String_Split and remove the last element of the list with the ListRemove action.

Solution

Hi Albert,

You can use ListFilter to get a new list without these elements.

You may also look into Forge to see if you find any Text extension that has a Split method that allows you to ignore empty items.

You can iterate the list and use only those elements that have something in it.

Cheers.

Albert_Li wrote:

Hello

1.I have a String likes "#0000003#" ,I want to split it to " "+ 0000003.

2.So I try to use String_Split to split "#" in the string.

3.But after split the String it looks like " " + 0000003 + " ", I don't need  the " " in the end of the List .

What can I do? Thank you very much.



Hello Albert,

You can do a ListRemove after the String_Split, and remove the last item. Don't know if that is what you want.


Best regards,

Miguel

Afonso Carvalho wrote:

Hey Albert,

String_Split alone won't do exactly what you need. You can either process the # symbols in a loop and decide how to handle the last one, or you can continue using String_Split and remove the last element of the list with the ListRemove action.

Thank you very much .


String_Split is removed as server action? I have the version 11.6.32

George Mitsiou wrote:

String_Split is removed as server action? I have the version 11.6.32

AFAIK, no. It is still there (I am using it).
Check if you have a reference for it from the Text Extension.


how can i add this server action?

Also, can be used for input form?I want to split text of it.

Just go to Manage Dependencies, select the Text extension, and check if the Split_String function is marked. If it is not, mark it. And yes, you can pass to it the variable associated with an input. 

By the way, it must be used inside another Server Action from your application. It can't be used inside a Client Action (if you're working with Mobile/Reactive apps).

P.S. It is always better to create a new topic when asking a question that is not related to the Post (like in this case). Bigger chances of someone seeing it. Fewer people will look into posts with lots of comments or with a solution. You were lucky that I decided to take a look. ;)