aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs41
1 files changed, 35 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index f5354c5..4cceb5f 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -907,15 +907,44 @@ namespace OpenSim.Region.ScriptEngine.Common
907 } 907 }
908 908
909 public string llGetSubString(string src, int start, int end) 909 public string llGetSubString(string src, int start, int end)
910 { 910 {
911 return src.Substring(start, end); 911 // substring expects length
912 } 912 // return src.Substring(start, end);
913
914 // if one is negative so use length of string as base
915 // if start > end then it is exclusive
916 // for length add +1 for char at location=0
917 if (start < 0) { start = src.Length-start; }
918 if (end < 0) { end = src.Length - end; }
919 if (start > end)
920 {
921 return src.Substring(0, 1+end) + src.Substring(start, src.Length - start);
922 }
923 else
924 {
925 return src.Substring(start, (1+end) - start);
926 }
927 }
913 928
914 public string llDeleteSubString(string src, int start, int end) 929 public string llDeleteSubString(string src, int start, int end)
915 { 930 {
916 return src.Remove(start, end - start); 931 //return src.Remove(start, end - start);
932 // if one is negative so use length of string as base
933 // if start > end then it is exclusive
934 // for length add +1 for char at location=0
935 if (start < 0) { start = src.Length - start; }
936 if (end < 0) { end = src.Length - end; }
937 if (start > end)
938 {
939 return src.Remove(0, 1 + end) + src.Remove(start, src.Length - start);
940 }
941 else
942 {
943 return src.Remove(start, (1 + end) - start);
944 }
917 } 945 }
918 946
947
919 public string llInsertString(string dst, int position, string src) 948 public string llInsertString(string dst, int position, string src)
920 { 949 {
921 return dst.Insert(position, src); 950 return dst.Insert(position, src);