Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
25 May, 2013, 22:58:25 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 ... 25 26 [27] 28 29 ... 42   Go Down
  Print  
Author Topic: Routines -  (Read 42585 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Quigibo
The Executioner
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 21 May, 2013, 02:03:21
Date Registered: 22 January, 2010, 05:02:37
Location: Los Angeles
Posts: 2022


Total Post Ratings: +1019

View Profile
« Reply #390 on: 04 September, 2010, 20:27:28 »
+3

By the way, I think I forgot to mention during the last update the additional uses for the inData() command because its more powerful than it looks.

First thing, yes, it can be used to find the position of a character in a string:

1
inData('I',"IGNITION")->L

To find the second, third, etc. instance of 'I', you could loop through this.

1
inData('I',"IGNITION"+L)->L

This moves the pointer to the spot directly after the last character found so it starts looking at the 'G' until it gets to the end.

Another use for this is to see if a number is part of a specific group.  The only problem with this is that 0 is always found at the end since its the terminating character.  So you should check for 0 before using the inData() command usually.  Another thing to mention is that inData() only works with bytes so make sure you guarantee that your input is restricted to numbers between 0 to 255 or -128 to 127.


1
2
3
4
5
6
7
8
9
10
11
12
.Inefficient
If (A=3 or (A=5) or (A=20) or (A=28) or (A=61))
.Some code
End

.Efficient
If A
  If inData(A,Data(3,5,20,28,61,0))
  .Some code
  End
End
This is probably unnoticeable slower, but its much smaller and the routine is a subroutine so using it more than once in your program will definitely be a large size optimization.
Logged

___Axe_Parser___
Today the calculator, tomorrow the world!
Pages: 1 ... 25 26 [27] 28 29 ... 42   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.644 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.