Plugins compiles ok, but doesn't work as expected (strings)
I've posted this over at dodplugins.net, but I'll post it here too since it's driving me nuts and I might get a faster reply here :?
I started working on my 2nd plugin today, I managed to get rid of all the compiler errors, but it doesn't run as expected and I can't work out why so I'm hoping one of you guys could help me out with this. Here's the code; Code:
<removed>At the moment punish() will only be called if there's no lower case characters in the string so "HELLO WORLD" will trigger it, but "HELLO WORLd" wont. What am I doing wrong? Any help with this would be really appreciated, I'm a complete newb at this so it's probably something completly stupid :?. Pyro |
Turns out I was misunderstanding how strings in SMALL work.
If string was set to "Hello World!" I'd expect string[1] to return "e", but instead it returns "ello World!". How would I go about getting only a single character from a string? |
try this:
Code:
if (isalpha(text[i]) && equal(text[i], text2[i], 1) ) { |
Quote:
Edit: Just tested and it's not working, probably because isalpha is returning false because of the null character terminating the string. |
Half way there thanks to an overly complicated hack :)
|
| All times are GMT -4. The time now is 16:41. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.