c# - How to split words in ASP.NET MVC4? -
how split words in asp.net mvc4?
this try far.
public actionresult index() { var aaa = system.text.regularexpressions.regex.split("12:::34:::55", ":::"); viewbag.test = aaa; return view(); }
but page shows system.string[]
.
you seeing string
representation of array.
to show elements, use string.join
:
viewbag.test = string.join(",", //insert separator here aaa);
this return "12,34,55"
.
if want have separate lines, replace ","
environment.newline
. can have spaces " "
, or other separator of choice.
Comments
Post a Comment