Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-04-2008, 04:10 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
I don't believe there is already an explode() or implode() function.

I'd imagine you could do one like this:
PHP Code:
echo(explode(",""1, 2, 3, 4, 5, 6"3)); 
PHP Code:
function explode(delstrlimit) {
  
temp.token str.tokenize(del);
  for (
temp.0temp.token.size(); temp.++) {
    if (
limit) {
      
temp.output.add(token[i]);
    }else {
      
temp.positions str.positions(del);
      
temp.output.add(str.substring(positions[1] + 1));
      break;
    }
  }
  return 
output;

Good luck.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #2  
Old 12-04-2008, 04:37 AM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by Tigairius View Post
PHP Code:
    }else {
      
temp.positions str.positions(del);
      
temp.output.add(str.substring(positions[1] + 1));
      break;
    }
  } 
That's exactly what I was looking for. Thank you, Tig. Though, for anybody thinking about using the script Tig provided: it's not the complete explode() function, as in PHP. I'll release mine publicly as soon as I finish it.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:30 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.