search for: trimwhitespace

Displaying 2 results from an estimated 2 matches for "trimwhitespace".

Did you mean: trim_whitespace
2005 Jan 08
1
sub( , perl = TRUE) overflow (PR#7479)
I'd like to report a bug (buffer overflow?) in the function sub(..., perl = TRUE) I wanted to implement the familiar perl function for removing white spaces before and after a character string: sub trimwhitespace($) { my $string = shift; $string =~ s/^\s+//; $string =~ s/\s+$//; return $string; } So in R this would (presumably) become: trimwhitespace <- function(x) { x <- sub('^\\s+', '', x, perl = TRUE) ## Removes preceding white spaces x <- sub('\\s+$', '...
2007 Aug 06
4
Function for trim blanks from a string(s)?
I feel like an idiot posting this because every language I've ever seen has a string function that trims blanks off strings (off the front or back or both). Ideally, it would process whole data frames/matrices etc but I don't even see one that processes a single string. But I've searched and I don't even see that. There's a strtrim function but it does something completely