Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding punctuation

Status
Not open for further replies.

botsb

Programmer
Joined
Jun 10, 2004
Messages
5
Location
NL
Hi there,

I'm a sort of a newbie to Crystal Reports, because I didn't use it for some years. I have a report which contains the initials of employees without punctuation. Now I'm looking for a simple formula which adds a point after each character.

My field is simply called "Initials". The number of initials is of course different for each employee. A sample of the data:

HGP
ME
PCJM
J

This is the result I want:

H.G.P.
M.E.
P.C.J.M.
J.

I tried some formula's based on a combination of Len(Initials) and While ... Do but it didn't work.
On the forum I found several formulas for stripping punctuation from initials, names, etc. but not a formula for adding punctuation.

Can somebody give me a small hint? Thanks in advance.

Greetings from Holland,

Berry
 
Try this

@initial
local stringvar initial:= {initialfield};
local numbervar l:= length(initial);
local numbervar i:=1;
local stringvar result:="";

while i <= l do
(
result:= result +initial+'.';
i:=i+1;
);
result;
 
Great!!! Thanks for the quick response. It solved my problem.

Greetings from Holland,

Berry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top