AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 0 |
r3wp | 7 |
total: | 7 |
results window for this page: [start: 1 end: 7]
world-name: r3wp
Group: Core ... Discuss core issues [web-public] | ||
Graham: 27-Mar-2006 | I don't use substr much at all either .. but your complaint was one I also felt :) | |
Bo: 27-Mar-2006 | So why doesn't someone write a .r file you can run that adds common functions for other languages (i.e. basic.r would have 'substr, | |
Bo: 27-Mar-2006 | Someone (or a group of someones) should write a .r file for the common languages (i.e. basic.r would include 'substr, 'peek, 'poke, etc.; rexx.r would include 'mid, etc.). That way, new users from other languages could move into Rebol with the knowledge they already have. Of course, the script flow would be different, but their favorite functions would be available, and they could see how to implement their favorite functions natively using 'source. There could also be a %c.r for those coming straight from C. :-) | |
Graham: 5-Nov-2008 | this is Gregg's substr function substring: func [ [catch] source [string!] spec [block!] /local start stop rule ][ rule: [set start integer! '.. set stop integer!] unless parse spec rule [ throw make error! "Invalid range spec." ] copy/part skip source start stop ] | |
Group: Parse ... Discussion of PARSE dialect [web-public] | ||
Janko: 14-Feb-2009 | hm.. would this be nicely solvable with a regex? .. I think it would be quite a pain by using regular string functions like strpos substr etc... having the same requirenments (one or more spaces/tabs/newlines " or ' , undefined order) | |
Group: SQLite ... C library embeddable DB [web-public]. | ||
Pekr: 27-Nov-2007 | I found the culprit but I doubt it is enough to track possible bug. Issuing following statement will make subsequent update corrupting data: sql trim/lines "insert into prevodnik select kod, nazev, puvodni_kod, puvodni_kod, typ from produkty where substr(kod,1,1)='9' and kod like '%BZ'" update or replace produkty set kod = (select novy_kod from prevodnik where prevodnik.kod=produkty.kod) where exists (select kod from prevodnik where prevodnik.kod=produkty.kod) | |
Group: !REBOL3-OLD1 ... [web-public] | ||
shadwolf: 2-Dec-2009 | in php they do it like that function getHTML($page=False) { if (!$page) $page = $this->path; $contents = ""; $domain = (substr($this->domain, 0, 7) == "http://") ? substr($this->domain, 7) : $this->domain; if (@$fp = fsockopen($domain, $this->port, $this->errno, $this->errstr, 2)) { fputs($fp, "GET ".$page." HTTP/1.1\r\n". "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)\r\n". "Accept: */*\r\n". "Host: ".$domain."\r\n\r\n"); $c = 0; while (!feof($fp) && $c <= 20) { $contents .= fgets($fp, 4096); $c++; } fclose ($fp); $this->encodeContent($contents); preg_match("/(Content-Type:)(.*)/i", $contents, $matches); if (count($matches) > 0) { $contentType = trim($matches[2]); preg_match("/(meta http-equiv=\"Content-Type\" content=\"(.*); charset=(.*)\")/iU", $contents, $matches); if (isset($matches[3])) { $this->setStreamEncoding($matches[3]); } if ($contentType == "text/html") { $this->isShoutcast = True; return $contents; } else { $this->isShoutcast = False; $htmlContent = substr($contents, 0, strpos($contents, "\r\n\r\n")); $dataStr = str_replace("\r", "\n", str_replace("\r\n", "\n", $contents)); $lines = explode("\n", $dataStr); foreach ($lines AS $line) { if ($dp = strpos($line, ":")) { $key = substr($line, 0, $dp); $value = trim(substr($line, ($dp+1))); if (preg_match("/genre/i", $key)) $this->nonShoutcastData['Stream Genre'] = $value; if (preg_match("/name/i", $key)) $this->nonShoutcastData['Stream Title'] = $value; if (preg_match("/url/i", $key)) $this->nonShoutcastData['Stream URL'] = $value; if (preg_match("/content-type/i", $key)) $this->nonShoutcastData['Content Type'] = $value; if (preg_match("/icy-br/i", $key)) $this->nonShoutcastData['Stream Status'] = "Stream is up at ".$value."kbps"; if (preg_match("/icy-notice2/i", $key)) { $this->nonShoutcastData['Server Status'] = "This is <span style=\"color: red;\">not</span> a Shoutcast server!"; if (preg_match("/ultravox/i", $value)) $this->nonShoutcastData['Server Status'] .= " But an <a href=\"http://ultravox.aol.com/\" target=\"_blank\">Ultravox</a> Server"; $this->altServer = $value; } } } return nl2br($htmlContent); } } else return $contents; } else { return False; } } |