Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Provjera brojeva u CSV fileu
Author Message
Son Goku Offline
Novi korisnik
*

Posts: 41
Joined: Jan 2008
Reputation: 0
Post: #1
Provjera brojeva u CSV fileu
Pozdrav.

Imam PHP skriptu koja provjerava CSV file koji moze imati neogranicen redova i u svakom redu ima 10 brojeva koji mogu biti od 1 do 20.
Sadrzaj primjera CSV filea(download http://www.2shared.com/file/WAhbs9yu/csv_brojevi.html):
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
9, 10, 11, 12, 13, 14, 15, 16, 17, 18
13, 14, 15, 16, 17, 18, 19, 12, 11, 10
5, 7, 8, 9, 12, 14, 2, 6, 1, 15
17, 12, 13, 6, 8, 9, 7, 19, 20, 16

I sada provjeravam u svakom redu koji brojevi nedostaju u razmaku od 1 do 20. Dakle nakon sto mi skripta izbaci sadrzaj CSV filea pokraj svakog reda mi se prikazu brojevi koji nedostaju u razmaku od 1 do 20.
Rezultat skripte:
Code:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10 - nedostaju: 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
9, 10, 11, 12, 13, 14, 15, 16, 17, 18 - nedostaju: 1, 2, 3, 4, 5, 6, 7, 8, 19, 20
13, 14, 15, 16, 17, 18, 19, 12, 11, 10 - nedostaju: 1, 2, 3, 4, 5, 6, 7, 8, 9, 20
5, 7, 8, 9, 12, 14, 2, 6, 1, 15 - nedostaju: 3, 4, 10, 11, 13, 16, 17, 18, 19, 20
17, 12, 13, 6, 8, 9, 7, 19, 20, 16 - nedostaju: 1, 2, 3, 4, 5, 10, 11, 14, 15, 18

E sada bi trebao postici da mu skripta provjerava svaka 2 reda, znaci 1 i 2 red, 2 i 3 red, 3 i 4 red, itd... Tj da mi se ispisu brojevi koji nedostaju pokraj svaka 2 reda, znaci ovako nesto da dobijem:
Code:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
9, 10, 11, 12, 13, 14, 15, 16, 17, 18 - nedostaju: 19, 20
13, 14, 15, 16, 17, 18, 19, 12, 11, 10 - nedostaju: 1, 2, 3, 4, 5, 6, 7, 8, 20
5, 7, 8, 9, 12, 14, 2, 6, 1, 15 - nedostaju: 3, 4, 20
17, 12, 13, 6, 8, 9, 7, 19, 20, 16 - nedostaju: 3, 4, 10, 11, 18
02-12-2011 11:59 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
Provjera brojeva u CSV fileu - Son Goku - 02-12-2011 11:59 AM
RE: Provjera brojeva u CSV fileu - r0tring - 14-12-2011, 11:08 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)