-
1
- #1
arcticpuppy
Technical User
I currently use this function to trim spaces from a string
function trim(str){
nsub1=sub("^[ ]*", "", str)
nsub2=sub("[ ]*$", "", str)
return str
}
I tried to use
nsub1=sub("^[ ]*", "\t", str)
nsub3=sub("[ ]*$", "\t", str)
to remove tabs and only was able to remove "tt" from my strings....does anyone have a asuggestion on how to remove leading tabs and following tabs from a string ?
function trim(str){
nsub1=sub("^[ ]*", "", str)
nsub2=sub("[ ]*$", "", str)
return str
}
I tried to use
nsub1=sub("^[ ]*", "\t", str)
nsub3=sub("[ ]*$", "\t", str)
to remove tabs and only was able to remove "tt" from my strings....does anyone have a asuggestion on how to remove leading tabs and following tabs from a string ?