Re: subStrings separated by...
Re: subStrings separated by...
- Subject: Re: subStrings separated by...
- From: arturo <email@hidden>
- Date: Wed, 17 Dec 2003 17:10:02 -0500
I was going to recommend StringTokenizer but then I found this.
StringTokenizer is a legacy class that is retained for compatibility reasons
although its use is discouraged in new code. It is recommended that anyone
seeking this functionality use the split method of String or the
java.util.regex package instead.
The following example illustrates how the String.split method can be used to
break up a string into its basic tokens:
String[] result = "this is a test".split("\\s");
for (int x=0; x<result.length; x++)
System.out.println(result[x]);
----- Original Message -----
From: "Ricardo Strausz" <email@hidden>
To: "WOdev List List" <email@hidden>
Sent: Wednesday, December 17, 2003 4:34 PM
Subject: subStrings separated by...
> Hola!
>
> This most be an easy one (for someone who knows Java);
> in a validateAtribute(String value) method of an EOGenericRecord's
> child, I want to check if the value have the form ABC-123456-XYZ (3
> letters, dash, 6 numbers, dash, 3 alphanumeric characters). In Obj-C,
> while using NSString, you simply use
>
> NSArray anArrayOfStrings = [value componentsSeparatedByString:@"-"];
>
> and then parse each of the 3 elements in the array.
>
> java.lang.String does not seem to have such a method (nor any that
> returns an array or vector).
>
> Any idea on how to acomplish this.
>
> Gracias,
> Dino
> _______________________________________________
> 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.