José,
Thanks for the help. I do not have an array as you used in your
example. I have a string that is comma delimited.
#set( $numbers = ["one", "two", "three","four"] ) = array
#set( $numbers ="one,two,three,four") = my comma delimited string
Since I have a string delimited by commas, I need to use split to
create an array to iterate over. I am not sure why split does not
appear to work, nor am I sure what reference documentation I should be
using. For example, is this just VTL documentation, or is this Java
string documentation, or C# strings, ect. The Java docs have a string
util function called split, that I tried that. Then I tried the C#
version of split, and nothing worked there.
Thanks again for any ideas,
Alex
On May 31, 3:28 pm, José Carvalho <
jose.barbosa.carva...@gmail.com>
wrote:
> Why not use:
>
> #set( $numbers = ["one", "two", "three","four"] )
>
> #foreach( $str in $numbers)
> $str
> #end
>
> I've never used NVelocity with
ASP.NET MVC, but I don't know if it is
> possible call the Split method from your variable $myString. One
> possible reason is that $myString is not created by NVelocity as a
> normal C# string. Have you tried do the same with a variable passed
> from controller?
>
> Cheers,
> José Carvalhohttp://
www.fe.up.pt/~ei03067/
>
> On May 31, 10:01 pm, Alex <
bamuel...@gmail.com> wrote:
>
>
>
> > I am using the NVelocity view engine with the latest
ASP.NET MVC
> > framework, preview 3. I cannot figure out how to split a comma
> > delimited string. Here is what I am trying and it is not working.
>
> > #set($myString = "one,two,three,four")
>
> > #foreach($str in $myString.Split(","))
> > $str
> > #end
>
> > I am not sure why this is not working. I can get substring and replace
> > to work just fine. What is wrong with split? What references should I
> > be using to see what string functions are available? I have tried the
> > VTL reference.
>
> > Thanks.- Hide quoted text -
>
> - Show quoted text -