This is a continued article from CakePHP 3 the Way to Reach Controller Invoking part 1 of 3.
index.php
remains the following 5 lines.
This is a continued article from CakePHP 3 the Way to Reach Controller Invoking part 1 of 3.
index.php
remains the following 5 lines.
I researched executed process in CakePHP 3, by controller execution. It was really complicated than I expected, so I omitted some explanation, and I guess it is somehow difficult to read this article, sorry.
Continue reading CakePHP 3 the Way to Reach Controller Invoking part 1 of 3I read what the CakePHP 3 built-in server is, which is start with php bin/cake.php server
.
I’ll introduce to you, how to split string into list by comma, make "a,b,c"
to ["a", "b", "c"]
.
You know that there are some function like splitOn
in Data.List.Split
module, but import Data.List.Split
didn’t work on Ideone. So, I, a haskell beginner, thought how to do it without other modules.
The following code do it. It split string, [Char]
only by comma.
1 2 3 4 5 6 7 8 9 10 |
split = _split [] _split ts "" = ts _split ts s = _split (ts ++ [(token s)]) (drop (length(token s) + 1) s) token = _token "" _token ys "" = ys _token ys (x:xs) = do if x == ',' then ys else _token (ys ++ [x]) xs |
split "a,b,c"
outputs ["a", "b", "c"]
.
You can specify any delimiter with the following. The delimiter should be a Char
.
1 2 3 4 5 6 7 |
split d = _split d [] _split d cs "" = cs _split d cs s = _split d (cs ++ [token d s]) (drop (length(token d s) + 1) s) token d = _token d "" _token d t "" = t _token d t (x:xs) = if (x == d) then t else _token d (t ++ [x]) xs |
split ' ' "a b c"
outputs ["a", "b", "c"]
.