I have this string vector (for example):
str <- c(\"this is a string current trey\", \"feather rtttt\", \"tusla\", \"laq\")
You can try
sapply(gregexpr("\\S+", x), length) ## [1] 6 2 1 1
Or as suggested in comments you can try
sapply(strsplit(x, "\\s+"), length) ## [1] 6 2 1 1