Fixed behavior of rivinSisaltamienMjonojenLkm

This commit is contained in:
Waldir Leoncio 2020-07-28 10:44:10 +02:00
parent 7ce0110928
commit ce3c3b7645

View file

@ -1,23 +1,24 @@
#' @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 <- length(line)
pit <- nchar(line)
tila <- 0 # 0, jos odotetaan v<>lily<6C>ntej? 1 jos odotetaan muita merkkej?
for (i in seq_len(pit)) {
merkki <- line[i]
if (merkki == " " & tila == 0) {
merkki <- substring(line, i, i)
if (isspace(merkki) & tila == 0) {
# Ei tehd?mit<69><74>n.
} else if (merkki == " " & tila == 1) {
} else if (isspace(merkki) & tila == 1) {
tila <- 0
} else if (merkki != " " & tila == 0) {
} else if (!isspace(merkki) & tila == 0) {
tila <- 1
count <- count + 1
} else if (merkki != " " & tila == 1) {
} else if (!isspace(merkki) & tila == 1) {
# %Ei tehd?mit<69><74>n
}
}