summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/Examples/strings.se
blob: a3a2bb3f493ca4b98d2e3422fc1d6d2c2808e631 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
def slice(text, from, to)
{
	bit = "";
	i = from;
	while(i < to)
	{
		bit = bit + text[i];
		i = i + 1;
	}
	return bit;
}

def replace(text, replacement, start_position, end_position)
{
	prefix = slice(text, 0, start_position);
	suffix = slice(text, end_position, len(text));
	result = prefix + replacement + suffix;
	return result;
}