FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   compare input data to external file and output
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: compare input data to external file and output  (Read 908 times)
kateto


compare input data to external file and output
« on: Mar 26th, 2005, 6:39pm »

Hi all!
 
I was wondering, how exactly can I do the following:
 
1)The user inputs a string of letters [convert uppercase to lowercase]. As soon as the 'enter' key is pressed, all the letters are assumed to be a word.
 
2)This word is then compared to a dictionary [a .txt file in the data folder]
 
3)If the word is encountered, it appears on the applet,
  else each letter is replaced by a circle.
 
------------------------------------------------------
 
This is my starting point:
 
BFont f;
 
void setup(){
  size(600,400);
  f = loadFont("Futura-Medium.vlw.gz");
  textFont(f,20);
 
  String word = "hot";
 
  String myArray[] = loadStrings("data.txt");
  for (int i=0; i < myArray.length; i++) {
    if (myArray[i].equals(word)) {
 println("hot");
 text(myArray[i],10,20);
    }
  }
}
 
------------------------------------------------------
 
Anyone?
 
Thanx in advance!!!
 
st33d

WWW Email
Re: compare input data to external file and output
« Reply #1 on: Mar 26th, 2005, 7:34pm »

Dealing with upper/lower case can be found here, you might consider myString.equalsIgnoreCase(otherString) or myString.toLowerCase():
 
http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html
 
Trimming that url down to the api folder (index.html) will give you the works on methods of manipulating information in java.
 
There is a java method of making a user input box.
 
http://processing.org/discourse/yabb/board_Programs_action_disp_lay_num_1083715240.html
 
There is also some work on a non java input library here but the textfield is not yet finished apparently.
 
http://www.thbbpt.net/interfascia/
 
And Fry has just told me how to make a non-standard textfield:
 
http://processing.org/discourse/yabb/board_Syntax_action_displa_y_num_1111861132.html
« Last Edit: Mar 27th, 2005, 3:37am by st33d »  

I could murder a pint.
kateto


Re: compare input data to external file and output
« Reply #2 on: Mar 27th, 2005, 5:29am »

on Mar 26th, 2005, 7:34pm, st33d wrote:
Dealing with upper/lower case can be found here, you might consider myString.equalsIgnoreCase(otherString) or myString.toLowerCase():
 
http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html
 
Trimming that url down to the api folder (index.html) will give you the works on methods of manipulating information in java.
 
There is a java method of making a user input box.
 
http://processing.org/discourse/yabb/board_Programs_action_disp_lay_num_1083715240_start_6.html
 
There is also some work on a non java input library here but the textfield is not yet finished apparently.
 
http://www.thbbpt.net/interfascia/
 
And Fry has just told me how to make a non-standard textfield:
 
http://processing.org/discourse/yabb/board_Syntax_action_displa_y_num_1111861132.html

 
-------------------------------------------
 
Thanx!!!
 
Pages: 1 

« Previous topic | Next topic »