[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

477.0. "TRIM trailing spaces only!" by DREAMN::LORADITCH (Seems like the nothing, never was) Wed May 20 1987 17:05

    
    
    f$edit ( src_str,"TRIM")
    
    removes LEADING and trailing spaces.
    
    I see nothing in the lexical doc for removing trailing only??
    
    Any suggestions?
    
    Thanks
    Dan    
T.RTitleUserPersonal
Name
DateLines
477.1Brute Force?COOKIE::KRANTZThu May 21 1987 19:404
    attach a leading nonblank char (say a '*'), trim the string
    and then remove the '*'?  Not pretty, but not difficult...
    
    			Joe
477.2prepend an x, trim, remove the xVIDEO::OSMANtype video::user$7:[osman]eric.sixFri May 22 1987 13:2511
How about

	$ str = "    some leading and trailing spaces   "
	$ write sys$output f$edit ("x"+str,"trim")-"x"

Kind of silly but it works.  For those of you that don't understand
gobbldigook yet, this means, put a letter "x" at the beginning, then
trim leading and trailing spaces, of which there will are only trailing,
then take off the protective "x".

/Eric
477.3ThanksDREAMN::LORADITCHSeems like the nothing, never wasTue May 26 1987 20:346
    Thanks, definitely not the prettiest, brute force never is.
    But it will do the trick.
    
    
    Dan