Don't click here unless you want to be banned.

LSL Wiki : llInsertString

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are
string llInsertString(string dst, integer position, string src)

Inserts src into dst at position and returns the result.

Unlike most other string/list functions, this one does not support using a negative position to count backwards from the end of the string.

llInsertString("abcdef", 3, "123"); // returns "abc123def"

ARGH!!! What an evil little ambiguity! I kept fussing with this function, trying to get it to count backwards... what a waste of time.
Channeling this anger, I created this little code snippet that will provide the backwards counting: -Chris
string insertString(string destination, integer position, string str) {
    if (position < 0)
        position += llStringLength(destination) + 1;
    return llInsertString(destination, position, str);
Passing -1 as position will provide the same functionality as appending str to the end of destination with the += operator.

I don't think passing -1 should append to the end, if this behaivor is wanted a very big integer should be passed instead. Using -1 this way, makes negative indexes work differently with this function then the other LSL functions. Using large integers (like 0x7FFFFFFF) has not been shown to effect performance -BW
string insertString(string destination, integer position, string str) {
    if (position < 0)
        position += llStringLength(destination);
    return llInsertString(destination, position, str);

str_replace by Chad Statosky - The list method can be nasty.
str_replace entirely rewriten by BW to be more robust.
string str_replace(string from, string to, string str)
    integer e = llStringLength(from) - 1;
    if(e > -1)
        string  b = str;
        integer c = -1;
        integer f = llStringLength(to) - 1;
        @loop;//instead of a while loop, saves 5 bytes (and run faster).
        integer d = llSubStringIndex(b, from) + 1;
//            c+=d;
//            str = llInsertString(llDeleteSubString(str,c,c+e), c, to);
//            c += f;
//            b = llGetSubString(str, c + 1, 0x4000);
            b = llGetSubString(str = llInsertString(llDeleteSubString(str,c+=d,c+e), c, to), (c += f) + 1, 0x4000);
            jump loop;

    return str;

This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | String Jasa SEO Jasa SEO Murah Sepatu Online Toko Sepatu Online Sepatu Sepatu Murah Sepatu Safety Sepatu Futsal Cheapes Hostgator Coupon Link Booking Televisori offerte Notebook Offerte Berita Terkini Internet Marketer Muda Internet Marketer Indonesia Portatile Apple RDAnet Lorks Karikatur Bisnis Modal Kecil Bisnis UKM Berita Terbaru Iklan Baris Jasa SEO Jasa SEO Murah SEO Indonesia Konsultan SEO SEO Belajar SEO Kursus SEO Kursus SEO Murah Jam Tangan Casio Jam Tangan Casio Jam Tangan Murah Jam Tangan Grosir Baju Terbaru Grosir Baju Baju Terbaru Grosir Baju Murah Bisnis Online Belajar SEO Kerupuk Kerupuk kulit Social Bookmark Dofollow Social Bookmark Kumpulan Puisi Kirim Puisi bola hantu Penumbuh Rambut Penumbuh Rambut timbangan WBC Wonogiri Jasa SEO Murah Jasa SEO Jam Tangan Murah
There is no comment on this page. [Display comments/form]