A while ago when I received the publication e'mail for my search demo, it said that:
"Mobius Evalon's space2plus() proc is terrible, since it really should be done
with either findText() or text2ascii()"
My question is why?
proc
space2plus(string as text)
for(var/i=1;i<=length(string);i++)
if(copytext(string,i,i+1) == " ") string = copytext(string,1,i) + "+" + copytext(string,i+1)
return string
This proc does exactly as it's designed to do. text2ascii() isn't necessary at all. Unless someone’s planning on sitting there and typing "something[alt 0160]to[alt 0160]search[alt 0160]for" (0160 is the ascii code for space.)
Otherwise it works fine.
What’s the perperse of nitpicking the way something is done if it uses good programming principles and does as it's ment to do?
findText() would be good here because using findText(), you could change all of the spaces in a string into addition signs without having to loop through each and every character in the string.
If you're trying to teach somebody to do something, you should teach them to do it as well as possible!