-
Login or Register
- Log in with
mapelem = ustrregexm(test, ".*(<map>.*</map>).*")
mapelem = ustrregexm(test, "(.|\n)*(<map>(.|\n)*</map>)(.|\n)*")
mapstr= ustrregexs(1)
mata: fh = fopen("auto.dta", "r") test = fread(fh, 612) // test = "ab<map>cd</map>ef" p1 = strpos(test, "<map>") p1 p2 = strpos(test, "</map>") len = p2 - p1 - 5 len start = p1 + 5 b = substr(test, start, len) b end
hexread
. mata ------------------------------------------------- mata (type end to exit) ------------------------ : fh = fopen("Sample.dta", "r") : test = fread(fh, 612) : mapelem = ustrregexm(test, ".*(<map>.*</map>).*") : mapstr= ustrregexs(1) : map = ustrregexra(mapstr, "</?map>", "") : x = ascii(substr(map, 9, 16)) : y = inbase(16, x) : for(i = 2; i <= cols(y); ++ i) y[1] = y[1] + substr("0" + y[1], -2) : frombase(16, y[1]) 3.18931e+38 <- This is a really small file, so it seems unlikely that the second value in the map element would be at this byte position : x = ascii(strreverse(substr(map, 9, 16))) : y = inbase(16, x) : for(i = 2; i <= cols(y); ++ i) y[1] = y[1] + substr("0" + y[1], -2) : frombase(16, y[1]) 0 <- The second value in <map> should be the byte value where the <map> element is located
ssc describe tuples
Leave a comment: