I think a common convention in this type of situation is to define what the "data type" is. That is you get each field one at a time in a pre-defined order. Then you can use the various tools available to convert it into the internal representation you wish to use. For example, when you expect an int, you can use ...

Hey guys, I am looking for a specific occurrence of a string in a larger string. Now im aware that the method Sting.indexOf(occurrence) will return the integer position of the first occurrence of the string im looking for, but i know that the string im looking for appears more than once in the larger string and i would like to find ...

Does anyone have any suggestions on what I could do to figure out the width of a string? Ex: If I have two strings: "WHOOO HOOO" vs "ITTY BITTY" Both strings have the same number of letters however when I use a font that is not fixed width - then the second string takes up less room when typed. Is there ...

I think what Henry is getting at is this: A simple search for a particular string -which happens to be a procedure name- might not be sufficient, since that string could also be part of a comment. So in the worst case, you'd have to have an actual parser for whatever syntax those file contain, in order to distinguish proper occurrences ...

Are you asking how to determine mathematically the number of different combinations of letters, given a particular string? I may very well be wrong, but isn't it the number of characters factorial? Say you had 5 characters, 5! equals 120. There are 120 different possible ways to rearrange the characters. Or take the sequence "123". 3 characters, so 3! equals 6: ...

I have building this program that works with exception handlers, while I believe I have it down pretty good, I am getting one type of error that I am not sure about. .\Date.java:63: ';' expected System.out.print('please enter a valid input: '); ^ .\Date.java:63: unclosed character literal System.out.print('please enter a valid input: '); ^ .\Date.java:63: cannot find symbol symbol : class enter ...

Hey guys, this is an interesting problem. Let's say I have a string like this: String s1 = "My name is Justin and I love writing code and writing about coding algorithms." +" In fact, some of my best days are created by working with coding algorithms." +" Even though I can't say for sure how much I truly love writing ...

Hello, I have a string strCurrentTableRow which contains xxxxxxxxxCD01xxCD01(A)xxxxxxxxAB01xxxxxxxxxxxAB01(A)xxxxxxxxx where x is any character and the position of AB01 can change anywhere. Now, I'm using a variable strCurrentRequiredJf which will have either AB01 or AB01(A), which will be dynamic, meaning it can be CD01 or CD01(A) as well based on the stuff selected by the end user. I have an IF ...

Hi friends, I have the following code. When I execute it is throwing this Error "cannot find symbol method getResponseHeader".. Can you Please help me to solve this Error. I have pointed all the below jar files but still Error exists. commons-httpclient-3.0.1.jar commons-httpclient.jar commons-httpclient-3.1-rc1.jar httpclient-4.1.1.jar org.apche.commons.httpclient.jar Code:- public class try2 { private static String nameSpaceID = "cogndvldap"; private static String userName ...

this is the question and my code Hilan International Bank decided to have a salary plan for its employees. In the new Policy, bonus is based on the fact that one is a senior staff or junior staff. You have been called in as a programmer to develop a software to meet this policys requirement: (a.) Create a class called Salary. ...

Hi, I have a string A= "Amsterdam" There is another string B= "amst" How do I find if String A contains B. I tried using the contains method but that is case sensitive. I also tried StringA.indexOf(StringB)>0 but this does not work if String A has a uppercase 'A' and string B with lowercase a. If String B="amst" or "Amst"(with uppercase) ...

Can I just point out that those comments in your code are completely worthless. Might sound like a nitpick, but if you're not thinking about whether your comments make sense, chances are you're not thinking about whether your code does, either. Anyways, Encephalopathic seems to have a handle on your problem, but just slow down and think about what you're trying ...

Did you see my last post? Did it stimulate you do do anything new? You know that your search is based on the carot position, correct? If the carot position isn't changed, you will continue to search based on the same spot in the string. Do you think that there may be anything in the JTextPane api (or one of it's ...

First, learn what code tags are and how to use them on computer programming forums Then, figure out how to read in a line of data from the file into a String variable. Then look through the definition of java's String class for methods that will allow you to search the String variable for a given piece of text. Repeat for ...

GaryJSF wrote: Thanks so much. I implemented the array solution and it seems to work but I am still testing it. Is there any advantaged to using the regex solution? Which one is better java standards? Since you put it that way, the array solution is better: it's pure Java, and completely transparent. You don't even need to know Java to ...

Hi, thank you for all your tips/hints/code. @calypso : What I don't understand in your code is the global 'count' variable. I simply don't get the picture (sorry). Another question: you're talking about that s'.indexOf('toFind', 'index'+1) would shorten the code. What do I have to replace Cheers Jonny Edited by: jonnybecker on Jan 14, 2009 12:02 PM

You might want to start by describing precisely what you want to match. If you can't describe it precisely to the forum in English, nobody will be able to help you describe it precisely to Java in regex. Also, when you post code, use code tags so it will be readable and not turn various characters into markup. When not in ...