Skip to content
Prev 67523 / 398506 Next

how to separate a string

To get the first character from a string, use substr(s, 1, 1)

To split strings at a period, use strsplit(s, "\\.") (the period must
be quoted, as "." matches anything in a regular expression).

To get the index for "." in a string, see "?regexpr, but you will not
need to do that if you use strsplit().

Cheers,
Rich
On 4/13/05, Cuichang Zhao <cuiczhao at yahoo.com> wrote: