| 02-23-2004, 03:39 AM | #1 |
how can i check certain letters or numbers in variables or strings example: 221251 how can i check the 4th number as a "2" in that variable AND how can i check if a number is odd or even? |
| 02-23-2004, 04:23 AM | #2 |
1) use substring 2) use modulo (MOD) |
| 02-24-2004, 02:54 AM | #3 |
a little confusion to me... can any explain this further? |
| 02-24-2004, 03:42 AM | #4 |
Since you want to get the 4th char you would go SubString(4,5) (I don't know if thats right for BJ version). As far as determining odd or evenness. Mod(N,2)==0 will return true if the number (N) is even, false for odd. 0 by this defination is even. You may want to explicitly handle it incase you disagree and say it is neither even or odd. |
| 02-24-2004, 06:10 AM | #5 |
Weaaddar was close with the substring but off slightly. Its suppose to be Substring(4,4), the first number is the start and the second is the end, therefor if they are the same number it checks only 1 character. |
