Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Function to return just numbers?

Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
08-11-2007 15:06
is there a function floating about that will take a string such as:

184f44b2-d7b9-d631-1514-d0d00ea7c5ba

and return just the numbers in it?

18444279 etc?

I will keep on looking but haven't come across one so far.
Object Pascale
moshi moshi
Join date: 27 Jan 2007
Posts: 648
08-11-2007 15:20
courtesy of Ezhar Fairlight
http://lslwiki.net/lslwiki/wakka.php?wakka=EzharFairlight

From: someone

// search 'src' and replace all occurences of 'find' with 'replace'
string ReplaceString(string src, string find, string replace) {
return llDumpList2String(llParseStringKeepNulls(src, [find], []), replace);
}


Quick and dirty working example:

From: someone

string ReplaceString (string src, string find, string replace) {
return llDumpList2String(llParseStringKeepNulls(src, [find], []), replace);
}

default
{

state_entry()
{
llSay(0, ReplaceString("184f44b2-d7b9-d631-1514-d0d00ea7c5ba", "-", "";));
}
}
_____________________
"Life is a game, play it." -- Mother Teresa.
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
08-11-2007 15:29
kk i think i managed to write one.
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
08-12-2007 09:17
This is cheapass and only works for UUIDs:

llDumpList2String(llParseString2List(uuid, ["a","b","c","d","e","f","-"], []), "";);
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
08-12-2007 12:04
OMG. hehe... I'll take the cheap-ass approach, LOL. That's exactly what I want it for, UUIDs, and tho mine seemed to work, it was like 21 lines, grin.