#include "internal.h" // replace will replace all occurences of the given bytes 'from' to bytes 'to' // edits are done in place and modify the string. // NOTE: as of now strings from and to must be the same size. void string·replace(string s, byte* from, byte* to) { vlong fromL = strlen(from); vlong toL = strlen(to); if (toL != fromL) { panicf("different sized replacement string not supported"); } vlong l = string·len(s); vlong i = l; vlong j = l; for (i = 0; i < l; i++) { for (j = 0; j < toL; j++) { if (s[i] == from[j]) { s[i] = to[j]; break; } } } }