26 lines
No EOL
819 B
R
26 lines
No EOL
819 B
R
#' @title Number of M queues
|
||
#' @param line line number
|
||
#' @return count
|
||
#' @description Returns the number of queues contained in the line. There must be a space between the queues.
|
||
#' @export
|
||
rivinSisaltamienMjonojenLkm <- function(line) {
|
||
# Palauttaa line:n sis<69>lt<6C>mien mjonojen lukum<75><6D>r<EFBFBD>n.
|
||
# Mjonojen v<>liss?t<>ytyy olla v<>lily<6C>nti.
|
||
count <- 0
|
||
pit <- nchar(line)
|
||
tila <- 0 # 0, jos odotetaan v<>lily<6C>ntej? 1 jos odotetaan muita merkkej?
|
||
for (i in seq_len(pit)) {
|
||
merkki <- substring(line, i, i)
|
||
if (isspace(merkki) & tila == 0) {
|
||
# Ei tehd?mit<69><74>n.
|
||
} else if (isspace(merkki) & tila == 1) {
|
||
tila <- 0
|
||
} else if (!isspace(merkki) & tila == 0) {
|
||
tila <- 1
|
||
count <- count + 1
|
||
} else if (!isspace(merkki) & tila == 1) {
|
||
# %Ei tehd?mit<69><74>n
|
||
}
|
||
}
|
||
return(count)
|
||
} |