I need help for the below requirement :
I have key value pair like {“1”,“Inv-01”},{“2”,“Inv-02”}, in future we may get some more like this key value pair. I am storing this value in config as {{“1”,“Inv-01”},{“2”,“Inv-02”} }. Is there any way i can convert this({{“1”,“Inv-01”},{“2”,“Inv-02”} }) to dictionary. If yes, Please let me know how to do this.
Is your question about variable type? If so, dict is Dictionary(Of String,String)
If your question is for the expression in details, the following will help you.
Adding on to the above question, Encountered issue for one of the sceanrio of similar kind,my string is like {{“”&“”,“”&“”},{“”‘“”,“”'“”}} i have converted to dictionary. The output dict is coming as Dictionary<string, string>(2) { { “"&"”, “"&"” }, { “"'"”, “"'"” } }. I dont want to have the " \ " to be included in the dictionary. As i am searching the string in key in an input string like, if input string contains string in dict key it has to replace that with dictionary value. How to avoid this \ to make it as plane dictionary like Dictionary<string, string>(2) { { “”&“”, “”&“” }, { “”’“”, “”'“” } }.
I tried this the above one the i got the result as :Dictionary<string, string>(2) { { “"&”, “&” }, { “"'”, “'” } }}. But still i have those " \ " added in the dictionary. Please have a look at the below SS:
Now, I can see \ character. What is your source data, excel ,text etc? Can you share your source data as file if possible? It’s no problem dummy data if the problem is reproduced.
Is this from immediate panel? If so, it’s C# style expression and there is no backsklash in actual data. Can you try to use Writeline or WtiteTextFile activity to check the content?
Hi @Yoichi , the first solution you gave me worked perfectly, when i try to print the key from dictionary it was coming with double quotes at the start and end like “&” i have replace that quotes then it worked perfectly fine.