Loading...
Processing Forum
Recent Topics
All Forums
Move this topic
Forum :
Share your Work
Programming Questions
Core Library Questions
Contributed Library Questions
Android Processing
Processing with Other Languages
Integration and Hardware
Library and Tool Development
Events and Opportunities
General Discussion
Sub forum :
Move this topic
Cancel
General Discussion
Other
exelabel
how to skip lines reading a txt file?
in
General Discussion
•
Other
•
5 months ago
say i want to read the every third line of my external txt file
how would i write the code?
1
Replies(2)
pauline303
Re: how to skip lines reading a txt file?
5 months ago
int textY = 10;
int textX = 10;
int numLines;
int yDist = 15;
String[] lines;
void setup() {
size(500, 400);
lines = loadStrings("README.txt");
numLines = height/yDist;
}
void draw() {
background(0);
int counter =0;
for (int i = 0; i < numLines; i=i+2 ) {
text(lines[i], textX, (yDist*counter++), width, 20);
}
}
Leave a comment on pauline303's reply
not_55
Re: how to skip lines reading a txt file?
5 months ago
Use BufferedReader and a simple test to load or ignore each line
<reading loop>
...
thirdLine++
if( thirdline % 3 )....load the line
...
<end reading loop>
Leave a comment on not_55's reply
Change topic type
Topic Type :
Discussions
Questions
No of days :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Change topic type
Cancel
Link this topic
Provide the permalink of a topic that is related to this topic
Permalink
Save
Close
Reply to exelabel's question
Top
Reply
{"z26418624":[25080000002092630],"z7188918":[25080000002098145],"z25186308":[25080000002093647]}
Statistics
2
Replies
225
Views
0
Followers
Tags
No tags available for this topic.
Cancel
Actions
Permalink
Related Posts
how do you load and display images ...
How to clear the screen on KeyPress...
check if string is in a file
Have some functions disappeared in ...
CSV Files read from specific URL