FW: adding hyphens?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FW: adding hyphens?

ViAnn Beadle
Oops, premature slip of the key.

1. break the string up into two substrings using the substr function.
2. use concatenate to concatenate the first string, the hyphen, and the
second string together.

Something like this should work: (completely untested)

String newstring (a7).
Compute newstring = concat(substr(oldstring,1,3),"-",substr(oldstring,4,3))

-----Original Message-----
From: ViAnn Beadle [mailto:[hidden email]]
Sent: Friday, February 06, 2009 4:20 PM
To: 'Parise, Carol A.'; '[hidden email]'
Subject: RE: adding hyphens?

Break the string up into two strings with substring.


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Parise, Carol A.
Sent: Friday, February 06, 2009 4:17 PM
To: [hidden email]
Subject: adding hyphens?

Hi Listers,

I come asking for syntax...again.

I've got a list of strings:

      180798
      181734
      181893
      182147

and i need to add a hyphen after the 3rd number/character

so it needs to look like:

      180-798
      181-734
      181-893
      182-147

I know someone posted this code at one time... but of course, i didn't
pay attention to it since i didn't need it at the time.  if someone has
this handy, i would really appreciate it.

Thanks a bunch.

Carol

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD