Forum Discussion

farhana_adeel's avatar
farhana_adeel
New Contributor
14 years ago

New line character is not working for aqString.ListSeparator

Hello,



I am using aqString.ListSeparator to get a substring out of my string in VBScript. Its working fine for all the other characters except new line. I have tried using VBNewLine for the new line but it doesn't work with aqString.ListSeparator. It doesn't parse the string. Here is my sample code:



Function  GetSubString(psListSeperator, psTextToSearch, psTextList)

  Dim str, i, result



  str = psTextList

 

  aqString.ListSeparator = psListSeperator                              

    

  For i = 0 to aqString.GetListLength(str) - 1

    call Log.Message((aqString.GetListItem(str, i)))

    if aqString.GetListItem(str, i) = psTextToSearch Then

    result = True

    Exit For

    Else

    result = False

    End If

  Next

  GetSubString = result

End Function



Any help is greatly appretiated!



Regards,

Farhana

2 Replies

  • Hello



    vbNewLine works well. For example, the list is like this:

    list = "bvn" & vbNewLine & "bvn1" & vbNewLine & "vbn2"

    The text to search for is bvn1.



    John
  • Hi Farhana,


    It looks like the input list does not contain new line characters. We tried the following code and everything worked well:




    ReturnValue = GetSubString(vbNewLine, "Item1", "Item0" & vbNewLine & "Item1" & vbNewLine "Item2")

    Log.Message(ReturnValue)


    Does this example work for you? If it does not, please send us the problematic project suite so we can investigate the problem.