I've got an exercise given out by my tutor and I'm basically stumped. Part of it is to compare words then work out the shortest number of characters that is required to uniquely identify them. For example..
cat dog horse
Out of this group of only the first letters can be used c, d, h where as other groups like ant and antelope would require ant, ante.
Given this problem I've been trying to figure out how to do this and so far I'm manage to split each word into char arrays but when I try to compare them with other copies for a match I get two errors, Either I get incompatible data types
or I get char cannot be dereferenced. I dont know how to use them exactly so I need some help, I have been looking at the API but theres so many methods my eyes are gone blurry lol. I've got to be able to compare each letter to another, whats the method to do that?
In order to use the "for each" loop, you need to be referencing an object which can return an iterator and, therefore, implements iterable. Since char is a primative datatype, it will not be iterable unless it is in some sort of collection (and an array is also primative, so it won't work either).
Anyhow, you can view the javadoc information for iterator here:
Thanks for the info. I ditched the use for chars for this problem since I found a method in the string class to handle such check. This is after hours of course of trail and error until I eventually came across it. The java libraries are insanely huge lol there is practically so many ways to do things.
That seem to work ok for me, letting me check each character in both the string arrays. I will no doubt check back here again if I need the code for handling characters.
- Question on characters. is there a difference between char[] and character[] ?
- When comparing certain strings and chars I notice it didnt seem to work when I compare == '' vs == "". The first single quotes seems to work for char but double quotes don't.
- Question on characters. is there a difference between char[] and character[] ?
- When comparing certain strings and chars I notice it didnt seem to work when I compare == '' vs == "". The first single quotes seems to work for char but double quotes don't.
1. Yep, but you have to spell it like this: Character (javadocs for this class at: http://java.sun.com/j2se/1.5.0/docs/api/ja.../Character.html The difference is that char is a primitive datatype (that is, it is not an object, but merely a value). The other version, Character (with the capitalization), is actually a real java Object (that is, it has a value and methods associated with it).
2. I believe the problem is this: Single quotes denote characters (e.g. 'a' and '6'). However, if you use " " you are referring to a string, not a character (e.g. "5" OR "Hello this is a string"). Also, strings cannot be compared (in java!) with the == operator (well, it would just compare the physical address, which I don't believe Java allows). To compare two strings, you need to use the syntax: string1.equals(string2) [this returns a boolean]
2. I believe the problem is this: Single quotes denote characters (e.g. 'a' and '6'). However, if you use " " you are referring to a string, not a character (e.g. "5" OR "Hello this is a string"). Also, strings cannot be compared (in java!) with the == operator (well, it would just compare the physical address, which I don't believe Java allows). To compare two strings, you need to use the syntax: string1.equals(string2) [this returns a boolean]
Arghh yess this is why I hate java. They could have bothered to incorporate strings a little bit more than just add it as a class. Sure some of the string methods are useful, but its not the same.
Hi guy. slave here.. i'm from japan. yokohama city /smile.gif" style="vertical-align:middle"
emoid=":)" border="0" alt="smile.gif" /> studying ...... doing master in Business (MIS) I'm new
in this forum /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> i
guess will have a good time here.. The work i love to do killing my time /tongue.gif"
style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> watching movies.. Making
website /wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> ....
i am editing this post because i meant to reply to the nine ways to promote your site and i think i
accidently posted a new topic i guess. the thread i was replying to was...
http://www.trap17.com/forums/9-ways-promote-site-t43286.html i hope this makes sense now
/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> to reread
lyons post on the first page(which was posted over a year ago i think). seo changes constantly and
what works today will probably not work tomorrow. why? because people will always abuse they way
things work and t....
Ok I made an SMF forum after all with my hosting account, and installed some mods on it and all
that, but why won't words appear on it!!!! Like it will say something like: :
(0) instead of Total Trade Count : (0) and there will be text areas with no words next to
it.....just wondering what I'm doing wrong lol.... And also some things like links at the top
and such......
Hi all. I am trying to make a list out of 2 list. The first list is a complete list of users id
from users table (List A) The Second list is of users id from another table (List /cool.gif"
style="vertical-align:middle" emoid="B)" border="0" alt="cool.gif" /> I want to subtrack the user
ids in List B from List A and make List C. Thanks in advance for any help /smile.gif"
style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Update: I looked up a old
sql book i had and found some query examples. I tried the EXCEPT statement in mysql but it dont wor....
This term is not so popular, but the concept(Collaborative Tagging) behind is widely used nowadays.
This was made popular by the widely discussed Web 2.0 . Folksonomy refers to public tagging or
labelling and extracting/searching/obtaining data from that. You can take del.icio.us for an
instance wherin you bookmark sites under various categories and that is searchable by others too...
To be precise, people sort contents into better categories than bots and that help others online to
get more relevant data. This became popular after these social networking and collob....
In the name of God In this short article we are going to explain how new words can be built in
Persian(Farsi), as an 'Indo-European' language (Indo-European languages include languages
like: Persian(Farsi), Greek, Latin, German, French, English,etc).This article is written based on
Prof.Hessabi's(the great Iranian scientist that is famous as the father of physics in Iran,peace
be upon him) discussion on Persian's capabilities vs Arabic. We are going to discuss on the
structure of Indo-European languages.we want to see how its possible to build many scient....
Hi, I was wondering about how far can i go with swearing in sigs and avatars? Because my sig i
usually use has a swear word in it and so does my avatar, also do you allow animated gifs as avatars
being used? Topic title...topic title...topic title... Nope, it didn't change. So I did. ....
I'm looking into signing up for a paid hosting account with someone. I was wondering how you
think these guys compare with trap17 and their partners computing host.
http://phpnet.us/paidplans.php vs. http://www.computinghost.com/plans.html ....
I should filter bad words and replace them with three dot. I know this is not so difficult to write
function for such purpose. But function that I wrote doesn't give any result neither necessary
result nor error. May be you know what's going wrong with my function. Code:
$abuse_list= array ("abuse","bad"); function filter_bad_words($s) { global
$abuse_list; foreach ($abuse_list as $k=>$v) {
eregi_replace("^".$v."$","...",$s); } return $s; } $s="abuse,
badness, bad wo....
I need a script that compares 2 variables, and looks for a difference between them. It will then
highlight the words that are different, as shown in the image below: So in the left cell, the
yellow text is the text that has been removed OR replaced. In the right cell, the green text is the
text that has replaced some text in the left cell, OR new text. This script will be used to
compare 2 versions of a document stored in the database, to see the difference between each change
(all revisions are stored in the database). I know that it's possible with PHP, beca....
I ran across this in Reader's Digest and thought it worthy of placing up here for
everybody in the Counceling, Advice, Support forums. QUOTE People will forget
what you said, people will forget what you did, but people will never forget how you made them feel.
...............Maya Angelou ....
hi everyone im opening up this new webmaster site, im offering design to people but im not quite
sure what to add for the packages which are Basic, Moderate and Advanced. I can offer anything
internet related but i dont know what to put as the features of a perticualr package anyone help?
Ive done the basic package which sounds like this Dedicated Lifetime Support Professional Design
Valid HTML,XHTML ect Discounted website hosting Access to client areas im stuck on what to do
for the Moderate and Advanced packages any ideas on what i could offer?....
ok, i'm sorry if i am just another noob in the adsense ocean but i'm so overhelmed by that
much info that i get unable to make anything...i always wanted to try it but never got it to a
result so please help me in a few issues: 1)i have built a website based on Wordpress and i would
like to get it online. Ok, here at trap17 if possible when i get all those points but my question is
if it's better to get an url redirection to a co.nr or smth like that as long as it concernes
seo? is mysite.co.nr better than mysite.trap17.com or it doesn't matter? 2)can....
This is my first short story -- sudden fiction to be more exact. Tell me what you think. A
FORTUNATE ACCIDENT JEFF? YOU GAVE MY NUMBER TO JEFF? I was supposed to tell you but that born
loser texted you before I had the chance. No I mean how do you know Jeff? We’re orgmates in Los
Banos. We were just sort of talking about you last Friday, we’re a starting a business eh. But
how does Jeff know that you know me? He doesn’t…I mean he didn’t. Huwhaaat? Ok so I met Mr.
Llangco the other day and he told me that Jeff met you. Where did Oliver come from? Uhm ....
HI to everyones!!!!! I did the registration (a long long tima ago) to ADD Words
di Google. But I can see that google is making a lot of money with my site, and I'm getting
nothing: from the last statistics, goggle get 25$ in the last month, and I get 0,78$ in
the same month. I'm not happy!! SOmeone maybe know about a way to encrease Entries
with the same quantity of code in my site???? Please help!! I beleve that Google is the
best way to make a good trafic, but not like this!!....
A picture is worth a thousand words, it has been said since time immemorial. and for those people
who are rushing to know and learn varied information, how much easier would it be to understand and
follow tutorials via pictures instead of reading a bunch of long and convoluted texts? some of you
are the "more visual" kind of learners who would understand computer-related and web-related topics
better with pictures, here is a treat for you all. /biggrin.gif" style="vertical-align:middle"
emoid=":D" border="0" alt="biggrin.gif" /> ALL ebooks below released by INPICS ca....
Hope this might be useful QUOTE 0-Day - Latest software releases. 0-Sec - Same as above,
although the period of time between ripping a game or application and it appearing on a warez site
is even shorter. Ace File - The first file in a series of compressed archives (the one you double
click on to decompress all the files at once). Active List - Similar to a mailing list, but uses
ICQ to send instant messages to subscribers. Alpha - Software receives this label when it is in the
very early stages of development. Usually full of bugs, so don't touch it with ....
I just read in another thread (about how to say "I love you" in other languages than english) that
someone in here doesn't say it because it "gets tossed around too often". I think it is not
being said (or at least thought) often enough. Why? I'll try to explain: At least among many
people I know, saying "I love you" implies "I want sexual contact with you". If someone says "I love
you" to gain sexual contact, I agree with those who claim that these three words are being tossed
around too much - if you want sex without any commitments, why don't you say so?....
QUOTE ' swear word n. An obscene or blasphemous word '. esp. uttered as an expletive.
Ok I dont want this thread to turn into a list of examples, but I'd be interested to hear
your views as to what makes a swear word. What is classed as an indecent word or what offends you,
in your view? Are some words acceptable in some cases and not in others? Just use upper case first
initial to signify which word you are referring to. Title modified. ....
Many websites display a contact email address in the format someone(AT)website(DOT)com so that bots
looking for emails to spam are unable to read the address. It has occurred to me that if you write
your email in escape chars you will have an equal chance of escaping bot detection and your email
will appear in the proper format - which is a neater solution and it would allow for the address to
automatically fire up the user's mail program with the MAILTO: URL type link, an option not
available using the (AT)(DOT) version. For example, my email address would be writ....
Here's a few of the FIRST sifs I made, I'll show 5 old, and 5 new. 1 2(one with actuall
brushing) Now here are my most revent sig; 1 2 3 4 5 Sorry if I mispelled anything, I
got hurt kinda bad today and I can't open my eyes fully. Comnents plase.....
Know some unknown history of words............................ MOPED is the short term for
'Motorized Pedaling'. POP MUSIC is 'Popular Music' shortened. BUS is the short term
for 'Omnibus' that means everybody. FORTNIGHT comes from 'Fourteen Nights' (Two
Weeks). DRAWING ROOM was actually a 'withdrawing room' where people withdrew after Dinner.
Later the prefix 'with' was dropped. NEWS refers to information from Four directions N, E, W
and S. AG-MARK, which some products bear, stems from 'Agricultural Marketing'. JOU....
My first words at the age of 2 were: Bye and Yes (not very special) But if you do had special first
words please let us know and reply! /biggrin.gif" style="vertical-align:middle" emoid=":D"
border="0" alt="biggrin.gif" /> My wrong spelled words: Tifisy - Televisie (Dutch) - Television
Tangepoesten - Tandenpoetsen (Dutch) - Brush Teeth Locola - Chocolade (Dutch) - Chocolate Did you
always spelled words wrong way too when you were a little kid? Reply and tell about it, its funny
really !!! ....
hey how can i search for a song on a internet program. i want a song with the word only like if you
want the background music only you type e.g. "GetLow kareoke" so what if i want only the word of Get
Low and no back ground music. How can i search for that?....
In Spanish, our teacher is always getting on us because we do not conjugate stuff right, because of
this damned formal stuff, usted and ustedes...why in the world do we have to learn it formally? no
offfense to anyone who is of a spanish origin, or who is at least trying to learn the lannguage of
the country they are in.....
does anybody know how to make a scrollbar for my game page I am making on my site. This whole site
is completely in flash. I know how to make a scrollbar for just words but not when there is an
image on there also. Does anybody know?....
Hi, Ok so right now things are going too well for we. I was just wondering what it is that keeps
you going in the mornings? What is it that gets you out of bed when the alarm clock goes off, what
is it that puts you to sleep at night? What words or sayings do you use to help you out in life, and
how do you motivate yourself to just keep on rolling? Personally, the only thing I can enjoy
about school is being with my mates. I ain't too kean on it to be honest, but some of my
favourite quotes to help out with the day are: Train Hard, Fight Easy. You gotta learn ....
Why does ATI release drivers more often than nVIDIA? I'm a nVIDIA FX5900XT owner and I'm
very jealous of the ATI people. /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0"
alt="biggrin.gif" /> Topic title must be specific. Title changed. ....
QUOTE cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg The phaonmneal pweor
of the hmuan mnid Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer inwaht
oredr the ltteers in a wrod are, the olny iprmoatnt tihng is taht the frist and lsat ltteer be
in the rghit pclae. The rset can be a taotl mses and you can sitll raed it wouthit a porbelm. Tihs
is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Amzanig
huh? yaeh and I awlyas thought slpeling was ipmorantt! I think th....
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE
forum, Create your own topics, Ask Questions, track topics, setup
subscriptions & notifications and Get a Free Website w/ Email and FTP.