ID:195111
 
//Title: String Insertion
//Contributed by: Jtgibson
//Credit to: Jtgibson


//This proc inserts a string inside another string.
// I can't think of any conceivable use for it, but if you
// find one, then more power to you. =)


proc/insert_string(string, string_to_insert, position)
if(position > lentext(string))
string += string_to_insert
return(string)
var/first_part = copytext(string, 1, position+1)
var/last_part = copytext(string, position+1)
return ("[first_part][string_to_insert][last_part]")


///*
//Testing code/sample implementation:

mob/verb/test_insert_string()
usr << "Your name is [insert_string(usr.name, "HONK!", round((lentext(usr.name)+1)/2))]."
//*/