it doesen mater if arrayToCompareTo is a comma seperatede string .Contains will just look for the "variable" in the string. so if variable ="Skole start"
It wil return true if arrayToCompareTo contains thats string
just one little thing more if there is only one thing in the list then it's not a comma-separated list and then it jumps over it how can I get it to print if it is true
Razor foreach
I use umbraco 4.11.5
I need a foreach loop where it compares two comma separated lists
the xml
and the second comma-separated lists are a form request
if one or more of the elements are the same, then print, but I would only have one item per child
You can split both your strings on the comma which will give you 2 array's.
Then you can compare the 2 arrays. Here is a stack overflow post about comparing 2 arrays : http://stackoverflow.com/questions/10991452/how-do-i-get-the-differences-between-two-string-arrays-in-c
Dave
Hi dawoe
I'm new in Razor
How do I convert them to array
You can do something like this:
Hi Kim,
if arrayToCompareTo is a comma-separated how do I make it so????
Hi Kim,
Yes it works :-)
thank you
it doesen mater if arrayToCompareTo is a comma seperatede string .Contains will just look for the "variable" in the string.
so if variable ="Skole start"
It wil return true if arrayToCompareTo contains thats string
so you only have to split one of the strings
BH, Udskoling
BH, Udskoling
Skole start, Mellem trin
and the results should be
BH, Udskoling
Skole start, Mellem trin
can you see where the problemt is??
This should help then :-)
and it did
thanks :-)
just one little thing more if there is only one thing in the list then it's not a comma-separated list and then it jumps over it how can I get it to print if it is true
Hi Kim
forget it
I reverse it and now it works as it should
a thousand thanks
is working on a reply...