check 2 « string « Java Data Type Q&A

1. checking the string

hi friends i have a string like this "manager,sales" i want to check another string (eg: job = "manager" ) is equal to the first part of the string ie "manager" and check for the second part also ie "sales" how to do this. i want to check the job equal the first parameter and second parameter thanks

2. How to check the encoding of the String?

Ok, but for example when you read from the file it can be encoded in the UTF-8 or ANSI coding. Moreover when read from the request in a servlet it is usually encoded in the UTF-8 coding. My question is how to determine the encoding. Maybe i wasn't clear enough in my previous post, sorry for that. Message was edited by: ...

4. Checking String for non-numbers

5. checking a string for useable data?

So that'd be? StringTokenizer st = new StringTokenizer(command, " "); if (st.hasMoreTokens()) { action = st.nextToken(); item = st.nextToken(); } Right? can I make it ignore things like articles as well? And Im looking at Split.string() now, it looks more tricky but I'll take your word for it. Thanks alot so far guys. null

6. like Nodelist, but create temp String for checking

I don't know where you get command from in the first place, but I understand taht this is not your question. If you declare previousCommand outside the loops and then inside the loop, at the bottom, just before }, assign command to previousCommand (the assignment that is already in your code), then the previous command will be available the next time ...

7. How to check if Object is String type?

9. check if it is a String

You are calling sc.nextLine() three seperate times. Once storing it to "getInput" Once not storing it Once storing it to "myInput" You never actually use the variable getInput. I get the feeling there should only be one variable, and one sc.nextLine() call in your code. Your inner while loop will always execute once, because sc.hasNextLine() will return block waiting for input. ...

10. Check String

You can't easily test that a String is in English, however you can check that a String uses a non-English characters. What makes it harder is that people often use non-English words in English and words can vary by dialect. You need to have a clear idea of what you are trying to check for. e.g. is it Australian English or ...