Search code examples
listfunctional-programmingerlangproperty-list

erlang string list concatenation


I have the following property list

PropList = [{numbers, ["22", "10"]}, {etc, "22"}].

I wish to get out the list ["22", "10"] like this:

proplists:get_value(numbers, PropList).

The problem is that I get the two strings inside the list concatenated, ie "2210". I tried using propertylists:lookup/2 to get the whole numbers tuple and pattern match to extract the list. But I still end up getting "2210".

I'm guessing it's because of the way erlang stores strings in memory.. Can someone help me here?

Later Edit: I've managed to extract and use the data if i do a map over the list of strings... Maybe this is just a printing issue?

Later-Later Edit I don't know what happened, maybe I'm too tired :) sorry guys. Will delete this question tomorrow


Solution

  • 1> PropList = [{numbers, ["22", "10"]}, {etc, "22"}].       
    [{numbers,["22","10"]},{etc,"22"}]
    
    2> proplists:get_value(numbers, PropList).
    ["22","10"]
    
    3> 
    

    That is my output with your given snippet.