TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

Help splitting a variable into two new variables

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help
View previous topic :: View next topic  
Author Message
elminster



Joined: 13 Jul 2009
Posts: 46

PostPosted: Fri Dec 23, 2016 8:52 am    Post subject: Help splitting a variable into two new variables Reply with quote

I'm capturing a variable that looks like this:

12345abc

What I would like to do is take this, and split it into two extra variables:

var1 12345
var2 abc

Is it possible to do this?

Thanks!
Back to top
View user's profile Send private message AIM Address
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Fri Dec 23, 2016 10:46 am    Post subject: Reply with quote

Maybe this could work ?

Code:

#var {first} {12345abc}
#OK. VARIABLE {first} HAS BEEN SET TO {12345abc}.

#regexp $first {{[0-9]*}{[a-z]*}} {#var second {&1};#var third {&2}}} {}
#OK. VARIABLE {second} HAS BEEN SET TO {12345}.
#OK. VARIABLE {third} HAS BEEN SET TO {abc}.
Back to top
View user's profile Send private message
elminster



Joined: 13 Jul 2009
Posts: 46

PostPosted: Fri Dec 23, 2016 2:37 pm    Post subject: Reply with quote

So simple and awesome. Thanks a million for the help.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group