🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7232

Re: string substitution in java

#7232
From: Joi Ellis [TeamB]
Date: Wed, 04 Jul 2001 14:03
29 lines
1908 bytes
WANG <wangjian@online.sh.cn> wrote:
> first question:
> Is there any way to substitute the string in java as like in c/c++ with
> sprintf or in delphi with Format(s,OPENARRAY(TVarRec,..)). It's very usefull
> to build the SQL statement in run time.

Look over java.text.MessageFormat.

> second question:
> With assignment of a long string I have to break it into several pieces and
> use + to concatenate them
> String s="select * from emp"+
>          "where .....";
> Is there a way not to use + concatenation as like in delphi/CB
> AnSistring s="select * from emp \
>               where .......";

Nope.  The Java language syntax does not allow strings to cross line 
boundaries.  Note that internally, the compiler recognizes the
sequence 'string constant + string constant' and gloms them together as
a single string at compile time.  So you need not worry about the concat
operation being a runtime cpu use.


-- 
Joi Ellis (TeamB)               http://www.teamb.com/
No direct email, please.
For best results, post on news server newsgroups.borland.com!
Newsgroup Info: http://www.borland.com/newsgroups/guide.html
Technical Details
Message-ID: <3b432233_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!not-for-mail
References: <3b431d00_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,ba6e4791af4b2918,start
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-07-04 07:09:30 PST
Message-ID: <3b432233_1@dnews>
From: "Joi Ellis [TeamB]" <joi@aravox.com>
Subject: Re: string substitution in java
Newsgroups: borland.public.jbuilder.java.language
References: <3b431d00_2@dnews>
User-Agent: tin/1.4.2-20000205 ("Possession") (UNIX) (Linux/2.2.16-3 (i686))
NNTP-Posting-Host: 209.46.41.66
Date: 4 Jul 2001 07:03:31 -0700
X-Trace: dnews 994255411 209.46.41.66 (4 Jul 2001 07:03:31 -0700)
Lines: 29
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!not-for-mail