Find the answer to your Linux question:
Results 1 to 3 of 3
I want to do a translation on a sentence that a user types in, then translate it to other language I got a database of words translation. But i don't ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2003
    Posts
    10

    Array


    I want to do a translation on a sentence that a user types in, then translate it to other language
    I got a database of words translation.
    But i don't know how to do an array.
    if ic an store all the string from the user input, and store it in an array, i can use a loop to translate each words and print them all as a sentence in another language.
    any idea?
    Thank you

  2. #2
    Just Joined!
    Join Date
    Apr 2003
    Location
    Australia & England
    Posts
    75
    What language are you using?
    There are a million tutorials on the net explaining how arrays work for whatever language, but they are generally all the same. I'll do a java example. Are you also sure you want arrays, or are you happy with a collection API?
    Code:
    String[] wordList = {"hello", "mr", "jones"};
    StringBuffer translatedSentance = new StringBuffer(100);
    
    for &#40;int i = 0; i < wordList.length; i++&#41; &#123;
            String translatedWord = wordList&#91;i&#93;;
            translatedWord.translate&#40;&#41;;
            translatedSentance. append&#40;translatedWord&#41;;
    &#125;

  3. #3
    Linux User
    Join Date
    Nov 2002
    Posts
    420
    nonono, i'm trying to write a shell program to translate anEnglish sentence into French, i got the french dicionary called french.cat, but how do i set an array to store all the words inside a sentence that the users puts in and then use a lopp to translate them all?

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •