Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006597opensim[REGION] Script Functionspublic2013-04-06 03:062019-02-26 05:14
ReporterTBG Renfold 
Assigned To 
PrioritynoneSeverityfeatureReproducibilityalways
StatusresolvedResolutionopen 
PlatformOSOS Version
Product Versionmaster (dev code) 
Target VersionFixed in Version 
Summary0006597: [PATCH] - Adds osStringStartsWith and osStringEndsWith.
DescriptionAllows scripters to check if a string starts or ends with specified text.

The functions are case sensitive (basically String.StartsWith/EndsWith).

Thought these would be helpful instead of comparing strings using llGetSubString = or != , which would possibly use llStringLength at some point as well.

Both functions return TRUE on match, otherwise FALSE.
Additional InformationosStringStartsWith("my string", "my"); << returns TRUE
osStringStartsWith("my string", "My"); << returns FALSE

osStringEndsWith("my string", "string"); << returns TRUE
osStringEndsWith("my string", "my "); << returns FALSE
TagsNo tags attached.
Git Revision or version number
Run ModeStandalone (1 Region) , Standalone (Multiple Regions) , Grid (1 Region per Sim) , Grid (Multiple Regions per Sim)
Physics EngineODE
Environment.NET / Windows32
Mono VersionNone
ViewerSingularity 1.7.3 (3624)
Attached Filespatch file icon 0001-Added-osStringStartsWith-and-osStringEndsWith.patch [^] (3,685 bytes) 2013-04-06 03:06 [Show Content]

- Relationships

-  Notes
(0023776)
cmickeyb (administrator)
2013-04-10 14:33

do you have a couple test scripts to verify that this is working correctly?
(0023777)
TBG Renfold (reporter)
2013-04-11 03:58

default
{
    state_entry()
    {

    }
    
    touch(integer t)
    {
        string TestString = "This string is checked at the start and end";
        
        //The following checks should return true.
        if (osStringStartsWith(TestString, "This")) // note, this is case sensitive
        {
            // This has returned true, so do something
            llOwnerSay("String starts with = true");
        }
        
        if (osStringEndsWith(TestString, "end")) // note, this is case sensitive
        {
            // This has returned true, so do something
            llOwnerSay("String ends with = true");
        }
        
        //The following checks should return false.
        if (osStringStartsWith(TestString, "is")) // note, this is case sensitive
        {
            // This has returned true, so do something
            llOwnerSay("String starts with = false");
        }
        
        if (osStringEndsWith(TestString, "and")) // note, this is case sensitive
        {
            // This has returned true, so do something
            llOwnerSay("String ends with = false");
        }
    }
}

I did do some tests on these functions, not tried them under loops/stress tests etc, but I would hope that they work correctly, after all, they are built in .net functions that have been wrapped and they haven't been adjusted in anyway internally.

I wont be able to try these functions out again at least until this weekend. Feedback would be helpful if anyone decided to try this patch out in the mean time.
(0034857)
TBG Renfold (reporter)
2019-02-26 05:14

Marking resolved as it's 5 years old and UBit added similar features a few months back in commit 9dfb906666.

- Issue History
Date Modified Username Field Change
2013-04-06 03:06 TBG Renfold New Issue
2013-04-06 03:06 TBG Renfold File Added: 0001-Added-osStringStartsWith-and-osStringEndsWith.patch
2013-04-06 03:06 TBG Renfold Status new => patch included
2013-04-10 14:33 cmickeyb Note Added: 0023776
2013-04-11 03:58 TBG Renfold Note Added: 0023777
2019-02-26 05:14 TBG Renfold Note Added: 0034857
2019-02-26 05:14 TBG Renfold Status patch included => resolved


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker