Printing Arrays...
-
Does anyone have a function, method or sip of code that will print an array to a multiline string like print_r() will do in PHP? Thank You
string Print(Array arr)
{
StringWriter w = new StringWriter()
foreach (object s in arr)
{
w.WriteLine(s);
}
return w.ToString();
}top secret
Download xacc-ide 0.0.3 now!
See some screenshots -
Does anyone have a function, method or sip of code that will print an array to a multiline string like print_r() will do in PHP? Thank You
I don't know neither PHP or print_r, but you could easily join a string with String.Join(Environment.NewLine, yourArray) and print it. Yes, even I am blogging now!
-
I don't know neither PHP or print_r, but you could easily join a string with String.Join(Environment.NewLine, yourArray) and print it. Yes, even I am blogging now!
print_r would print it something like this [0] => [0] => "Value0" [1} => "Value0b" [1] => [0] => "Value1" [1} => "Value1b" [2] => [0] => "Value2" [1} => "Value2b" [3] => [0] => "Value3" [1} => "Value3b" ... [n] => [0] => "Valuen" [1} => "Valuenb" 3-dimensions would branchout 3 times... 4, 4times... you get the drill
-
print_r would print it something like this [0] => [0] => "Value0" [1} => "Value0b" [1] => [0] => "Value1" [1} => "Value1b" [2] => [0] => "Value2" [1} => "Value2b" [3] => [0] => "Value3" [1} => "Value3b" ... [n] => [0] => "Valuen" [1} => "Valuenb" 3-dimensions would branchout 3 times... 4, 4times... you get the drill