s-news
[Top] [All Lists]

Trimming character strings

To: S-News <s-news@lists.biostat.wustl.edu>
Subject: Trimming character strings
From: Thom Burnett <Thom.Burnett@cognigencorp.com>
Date: Thu, 27 Jan 2005 14:30:16 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113
This should be quick and easy for someone.

How do I remove leading and trailing white space from a string?

nameWithSpaces <- "  John Doe  "
onlyName <- whatFunction(nameWithSpaces)
onlyName
"John Doe"

I thought I saw a function for this some month or so ago but now I can't find anything short of using substring one character at a time.

Thanx for any help.

Thom


<Prev in Thread] Current Thread [Next in Thread>