Focal Point
[SOLVED] problem with string

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4691027792

September 01, 2008, 07:01 AM
roby
[SOLVED] problem with string
Hello,
i have this problem:
I have two string:
Name a(35) (this string can cointains one or more word. If cointains more word I must to insert '_' between the word )
Surmane A(35)
I must write only string.

For exemple:
Name = MARIA ROSA
Surname = ROSSI
NEW_STRING = MARIA_ROSA ROSSI

Thanks for any help!!

This message has been edited. Last edited by: Kerry,
September 01, 2008, 08:26 AM
Tony A
Roby,

You haven't filled in your signature with the version that you are running so I don't know if this function is available to you - one reason why you should fill in your signature!

Use STRREP, if it's available to you, on the Name string and then hard concatenate (||) the result to the result of a soft concatenation (|) of a space and the surname-

NEW_STRING/A71 = STRREP(............) || (' ' | Surname);

Use search (top right) to locate previous posts on STRREP or use the help files in Dev Studio.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
September 01, 2008, 09:28 AM
roby
I don't know the STRREP function.
I use FOCUS 7.2.0.

Can you help me?
Thanks
September 01, 2008, 09:56 AM
Tony A
Roby,
quote:
Use search (top right) to locate previous posts on STRREP or use the help files in Dev Studio.
Click "Search the Technical Documentation Library" link in the top right hand area of this page and then in the right hand pair of form inputs choose "FOCUS/WebFOCUS Messages" and then type STRREP in the lower text box. Click GO to get a result set from your search. I'd suggest the fourth item in the list as being the best for your understanding.

Good luck

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
September 01, 2008, 11:00 AM
susannah
for handling the first name,

APP PATH ibisamp
DEFINE FILE EMPLOYEE
LENGTH/I2=ARGLEN(25,JOB_DESC,LENGTH);
NEWJD/A25=STRREP(25,JOB_DESC,1,' ',1,'_',25,NEWJD);
JOB_DESC_OUT/A25=SUBSTR(25,NEWJD,1, LENGTH, LENGTH, JOB_DESC_OUT);
END

 
TABLE FILE EMPLOYEE
BY JOB_DESC BY LENGTH BY NEWJD BY JOB_DESC_OUT
END 

Roma,
i've had ageda with using just the STRREP function , as it will replace all the trailing blanks as well,
so my workaround is to
1) find the actual length of the name using the ARGLEN function
2) do the replace
3) then trim the result back to the beginning length, using the SUBSTRing function.

Now you're ready to concat the LAST_NAME; Proceed as T has demonstrated for you.

As T suggests, the manual 'USING FUNCTIONS' is one of the 4 core manuals, and its priceless in value. Focus has text editing functions that are sine qua non.
-S.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
September 01, 2008, 01:36 PM
Leah
You might also look into using the GETTOK option. Note when building strings with concatenation, the length of the target string must be defined of a length at least as long as the sum of the two originating strings.


Leah
September 02, 2008, 04:15 AM
roby
Thanks! Big Grin