On Thu, Feb 25, 1999 at 01:25:24AM +0100, Oliver Pistor wrote:
> Hi!
> I'm just fighting with the incomplete String classes.
Then you haven't read the javadocs. String's good, but it was
never meant to do _everything_.
> I urgently need methods like split() [not only a split by a single character
> token, but a split with a string as token] or
> some decent replace() and all the "string-stuff" you need to build dynamic
> database queries, HTML pages etc.
Splitting on tokens -- character or string tokens -- can be
done in a simple way by java.util.StringTokenizer. StringTokenizer
even implements the Enumeration interface, so if you've used that
before, you'll have no problem.
Some of the functionality for a "replace()" call (I assume you
mean something like C's printf()) can be simulated with
java.text.MessageFormat. I've never needed anything for SQL queries,
because they tend to be very well structured and easy to build just by
using the '+' operator. Don't forget to do the appropriate escaping,
or just use PreparedStatement instead.
For building HTML pages, the Apache JServ project has a great
template library -- see http://java.apache.org. This package
lets you keep your HTML outside your code and just add simple tags to
drive variable substitution, repitition (looping) and conditional
inclusion. Since all the copy and formatting is outside your code, the
result is very maintainable even for people who don't know Java.
--
Robert Crawford [EMAIL PROTECTED]
http://www.iac.net/~crawford
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html