diff extra/cgi/inst/@cgi/private/parseline.m @ 12651:b3fcb76b0b96 octave-forge

remove old strsplit
author abarth93
date Mon, 22 Jun 2015 20:33:12 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extra/cgi/inst/@cgi/private/parseline.m	Mon Jun 22 20:33:12 2015 +0000
@@ -0,0 +1,17 @@
+% Content-Type: multipart/form-data; boundary=AaB03x
+% todo: handle quotes
+
+function [header_type,header_value,attrib] = parseline(line)
+
+parts = strsplit(line,':');
+header_type = parts{1};
+
+parts2 = strsplit(parts{2},';');
+
+header_value = strtrim(parts2{1});
+
+
+for i = 2:length(parts2)
+    parts3 = strsplit(strtrim(parts2{i}),'=');
+    attrib.(strtrim(parts3{1})) = parts3{2};
+end