cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Cordes <mcord...@maine.edu>
Subject Re: SERIOUS HELP WITH SPLIT METHOD
Date Thu, 21 Dec 2000 17:10:15 GMT
why not just use StringTokenizer?  I'd bet thats how the split 
class works.

e.g...

public static split( String str )
{
	StringTokenizer st = new StringTokenizer( str );

	String[] arrayOfValues = new String[ st.countTokens() ];

	for ( int x; st.hasMoreTokens(); ++x )
	{
		arrayOfValues[x] = st.nextToken();	
	}

	return arrayOfValues;
}	

I think that will probably work... You should probably 
add some error checking too :)




-matt

On Thu, Dec 21, 2000 at 12:09:53PM +0100, davide semprini wrote:
> Hi community,
> I have a problem with Split Method,
> 
> I have a string like: "IsBasedOn Id45"
> and I want to split this with Split method into
> a string array,
> I would like obtain String[1]="IsBasedOn"
> and String[2]="Id45"
> The problem is that cocoon don't know this method,
> My code is:
> 
> 
> <xsp:logic>
> 
> String IsBasedOn="IsBasedOn";
> String IsBasisFor="IsBasisFor";
> 
> public String Conv_rel(String stringa) {
> 
> <!-- inside I want invoke split method passing variable stringa
> and obtain an array string -->
> 
> 
> }
> </xsp:logic>
> 
> In xsp web page I find:
> String[] split(String line)
> 
> How I can do and use this method?
> 
> 
> tanks a lot!
> 
> Semprini davide
> 
> 
> 
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 

Mime
View raw message