'VBScript - Spliting a String with 2 target chars, turning them in composite Array and then removing those unnecessary from the array

I have a question that could be easy or not.

I will explain further: I have a string like this:

str = "TR~Maintenance~fas plus-maintenicon|GR~Supplies~fas minus-suppicon|JK~Affidavit~fas minus-affiicon"

Now, my objective is to put those in an array separately like:

TR
Maintenance
fas plus-maintenicon
GR
Supplies
fas minus-suppicon
JK
Affidavit
fas minus-affiicon

and then reshape and redim the array to keep only, let's say, the strings starting with fas....

What is the easiest method? Spliting? regEx? inStr?

I have the following code:

Function funcSeparaLista(objLst)
    arrVLst = split(objLst, "~")
    
    for each x in arrVLst
        VLst = VLst&x&"<br/>"
    next
        
    funcSeparaLista = split(VLst, "|")
end function

t = funcSeparaLista(str)

But retrieving the data using:

response.write(t(0))
response.write(t(1))
response.write(t(2))
response.write(t(3))

I get undesired results:

TR
Maintenance
fas plus-mainteniconGR
Supplies
fas minus-suppiconJK
Affidavit
fas minus-affiicon

One thing most important: I want my FUNCTION only to deal with putting the detached string in arrays and dealing with it after in another portion of code.

After the array hold everything like I want it, I want only the array to keep this data:

fas plus-maintenicon
fas minus-suppicon
fas minus-affiicon

What I am doing wrong? Remember please. This is vbscript, not VB.Net. Thanks in advance I think this could be very easy but I am not quite trying to accomplish it after some hours redoing and checking code.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source