Hello Mohannad,
number and string as basic types are always copied in Ring. However, because you are allowed to pass lists by reference, keeping strings you want to modify inside the list, gives you possibility to modify strings without copy. Sadly, basic type rule applies for list items too, so entire list must be referenced.
Greetings,
Ilir
aList = ["Hello-World"]
fastSubStr(aList,1,"-"," ")
? aList[1]
aList = ["Hello- -World"]
fastSubStr(aList,1,"-","")
? aList[1]
func fastSubStr(aList,index,char,replace)
/* No copy case */
if replace
for ch in aList[index]
if ch = char
ch = replace
ok
next
/* Deep copy case */
else
aList[index] = substr(aList[index],char,replace);
ok