hoanglo 3 Posted March 15, 2016 Report Share Posted March 15, 2016 Hi,I want to check if a string is numeric? If it's numeric calculate the sum of all of its digits? I found this plugin thread which might help but the download link is down.http://network.ubotstudio.com/forum/index.php/topic/16039-free-string-management-plugin/ Thanks for your help Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted March 15, 2016 Report Share Posted March 15, 2016 the plugin should work but you can do this with IPY(ironpython) or Regex What ubot license do you have? what is the value you are checking? CD Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted March 15, 2016 Report Share Posted March 15, 2016 try something like this alert($is num(123))alert($is num("adl"))define $is num(#STRING TO CHECK) { if($comparison($find regular expression(#STRING TO CHECK,"\\d.*"),"!= Does not equal",$nothing)) { then { return("true") } else { return("false") } }} if you are subscribed and always will beuse advance text in the bot bankalert($is number(12345)) CD Quote Link to post Share on other sites
hoanglo 3 Posted March 17, 2016 Author Report Share Posted March 17, 2016 Thank try something like this alert($is num(123))alert($is num("adl"))define $is num(#STRING TO CHECK) { if($comparison($find regular expression(#STRING TO CHECK,"\\d.*"),"!= Does not equal",$nothing)) { then { return("true") } else { return("false") } }} if you are subscribed and always will beuse advance text in the bot bankalert($is number(12345)) CDThank you very much.I figured this out on my own using regular expression to extract digits from the string. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.