Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
NVelocity String Functions - Split
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Alex  
View profile  
 More options May 31 2008, 5:01 pm
From: Alex <bamuel...@gmail.com>
Date: Sat, 31 May 2008 14:01:43 -0700 (PDT)
Local: Sat, May 31 2008 5:01 pm
Subject: NVelocity String Functions - Split
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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
José Carvalho  
View profile  
 More options May 31 2008, 5:28 pm
From: José Carvalho <jose.barbosa.carva...@gmail.com>
Date: Sat, 31 May 2008 14:28:46 -0700 (PDT)
Local: Sat, May 31 2008 5:28 pm
Subject: Re: NVelocity String Functions - Split
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é Carvalho
http://www.fe.up.pt/~ei03067/

On May 31, 10:01 pm, Alex <bamuel...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex  
View profile  
 More options Jun 1 2008, 12:51 am
From: Alex <bamuel...@gmail.com>
Date: Sat, 31 May 2008 21:51:20 -0700 (PDT)
Local: Sun, Jun 1 2008 12:51 am
Subject: Re: NVelocity String Functions - Split
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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hamilton Verissimo  
View profile  
 More options Jun 1 2008, 1:40 pm
From: "Hamilton Verissimo" <hamm...@castlestronghold.com>
Date: Sun, 1 Jun 2008 14:40:06 -0300
Local: Sun, Jun 1 2008 1:40 pm
Subject: Re: NVelocity String Functions - Split
From here http://msdn.microsoft.com/en-us/library/system.string.split.aspx
it looks like there's no overload for a string, only char and string
arrays. so it's not finding the overload, and that's why it's not
working

--
Cheers,
hamilton verissimo
hamm...@castlestronghold.com
http://www.castlestronghold.com/

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex  
View profile  
 More options Jun 1 2008, 11:21 pm
From: Alex <bamuel...@gmail.com>
Date: Sun, 1 Jun 2008 20:21:45 -0700 (PDT)
Local: Sun, Jun 1 2008 11:21 pm
Subject: Re: NVelocity String Functions - Split
Thanks for the help, both of you. I have moved forward, without the
split, passing the array to my view as needed. Split would sure be
useful in that case.

On Jun 1, 11:40 am, "Hamilton Verissimo"


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »