Revert "Bygex - Regex implementation for byond."

This reverts commit a9bea16ac8.
This commit is contained in:
Zuhayr
2013-12-15 14:16:21 +10:30
parent 18a75b8dfd
commit b048f0a00a
4 changed files with 29 additions and 109 deletions

View File

@@ -194,7 +194,35 @@ proc/checkhtml(var/t)
/*
* Text modification
*/
//Adds 'u' number of zeros ahead of the text 't'
/proc/replacetext(text, find, replacement)
var/find_len = length(find)
if(find_len < 1) return text
. = ""
var/last_found = 1
while(1)
var/found = findtext(text, find, last_found, 0)
. += copytext(text, last_found, found)
if(found)
. += replacement
last_found = found + find_len
continue
return .
/proc/replacetextEx(text, find, replacement)
var/find_len = length(find)
if(find_len < 1) return text
. = ""
var/last_found = 1
while(1)
var/found = findtextEx(text, find, last_found, 0)
. += copytext(text, last_found, found)
if(found)
. += replacement
last_found = found + find_len
continue
return .
//Adds 'u' number of zeros ahead of the text 't'
/proc/add_zero(t, u)
while (length(t) < u)
t = "0[t]"