Re: seperate String!
Re: seperate String!
- Subject: Re: seperate String!
- From: Jonathan Rochkind <email@hidden>
- Date: Wed, 4 Feb 2004 13:49:44 -0600
It doens't work becuase it's ObjectiveC code, and you presumably are
writing Java, not ObjectiveC. WebObjects used to use ObjectiveC (and
then for a while, both ObjC and Java), so some old documentation uses
ObjectiveC code. But in this case, the reason you are getting
ObjectiveC sample code is because, judging from the URL, you are
looking at Cocoa documentation. Don't, unless you are writing Cocoa.
Look at WebObjects documentation.
Anyway, the Java version of the example would be:
String list = "wrenches, hammers, saws";
NSArray listItems = NSArray.componentsSeparatedByString( list, ",");
I think (I may have the order of the arguments wrong). Check the
NSArray documentation to be sure.
It helps to be familiar with Java syntax in order to develop WO
applications in Java.
--Jonathan
At 5:41 PM +0100 2/4/04, WebObjects EMail wrote:
hello,
i want to spilt a String and put the parts in NSArray.
during i try to do that manually i saw an example for that on
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Java/Clas
ses/NSArray.html#//apple_ref/doc/uid/20000182/componentsSeparatedByString_Cla
ssMethod_NSArray
NSStringReference list = "wrenches, hammers, saws";
NSArray listItems = [list.componentsSeparatedByString (", ")];
it does that work for me automatically more or less, but it does not work.
I get this
Error Syntax error on token "[", "{", "+", "-", "--", "++", "boolean",
"void", "byte", "short", "int", "long", "char", "float", "double", "(",
"true", "false", "IntegerLiteral", "LongLiteral", "FloatingPointLiteral",
"DoubleLiteral", "CharacterLiteral", "StringLiteral", "null", "~", "!",
"super", "this", "new", "Identifier" expected MailRoboter.java Online/src
line 187
Error Stops on "[list" part.
can anybody tell me please why does this code dont work?
thank you !
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.