1. Calculation with char java-forums.org// Convert numOne from a string to double double doub_numOne = Double.parseDouble(numOne); // Convert operand from a string to a char int ascii = operand.charAt(0); char x = (char)ascii; // Convert numTwo from a string to double double doub_numTwo = Double.parseDouble(numTwo); // Perform the computation double compute = (doub_numOne x doub_numTwo); // Output to the screen System.out.printf("%.02f %c %.02f = %.02f", ... |
2. char compilation process java-forums.orgI got into thinking about security the other night and was thinking about String comparisons; perhaps instead of a String, there could be some class that holds a char[] full of data that represents the String: Such that: "Hello" == 'H' + 'e' + 'l' + 'l' + 'o' == {72, 101, 108, 108, 111} Obviously you could have some kind ... |
3. How can i insert a char into a string java-forums.orgSo... I was trying to use this as an example for what I'm trying to do. Basically I just want to add a 1 or a 0 to the end of a pre-existing String. <-binary conversion stuff. Anyway, so when i try to do it, Eclipse keeps telling me a I need to create a method for StringBuffer(String).. example.. output = ... |
4. char problem. java-forums.orgOkey I'll keep it simple... I have a encoding problem. Here is what im doing: Java Code: private InputStream instrom; // make space for InputStream. instrom = sPort.getInputStream(); // get stream from serialport. // I add a eventlistener to the port sPort.addEventListener(this); public void serialEvent(SerialPortEvent e){ // eventlistener switch (e.getEventType()){ // switch on different events case SerialPortEvent.DATA_AVAILABLE: // if data availeble ... |
5. ERROR - char cannot be dereferenced HELP java-forums.org |
6. Char[] issue java-forums.org/** * The function below would get a node that isn't in the current proposedPath. * @return String node */ public String getNextSuitableNode() { char[] cArray = proposedPath.toCharArray(); // converting the proposedPath string into an array of characters. String nextNode = getNeighboursNames().get(new Random().nextInt(getNeighboursNames().size())); if(!cArray.asList(cArray).contains(nextNode.charAt(0))) // i.e. if the Char Array doesn't contain that nextNode. { return nextNode; } else { // ... |
7. Problem with scanning char java-forums.orgIt's hard to say what the problem is based on the information at hand, but this suggests that your String has no characters in it. Perhaps prior to this code block, you've used the Scanner object to get a next() or nextInt() and did not also take care to swallow the end of line token with a nextLine() call, but I'm ... |
8. Add char java-forums.orgThat's right. The values d1, d2 and d3 each one belongs to a class, I want to add these values and compare with "abc", String actual = "abc". (this password problem and banks - ATM in each screen (frame) the User prescionar a button under your password with letters of the alphabet) |
9. Help with char and string java-forums.orgI am very new to Java and have problems understating char function I have lab in which asks to do: Method: calcPoints Parameters/Return: One parameter with letter grade of type char. Returns the points for the grade Purpose: Converts the grade to its equivalent point value. You must use a switch statement in the method calcPoints to convert the grade to ... |
10. Range char forums.oracle.comHi, I'm taking the 310-055 SCJP Exam on Monday. But I still got a question about the range for the "char" primitive type: This compiles fine: char c = '\u0000'; This one too: char c = '\uffff'; But this one for instance gives a compilation error: char c = '\000A'; Why? tia, |
11. how to change char 'a' to char 'p'? forums.oracle.com |
12. error with TO_CHAR function forums.oracle.comint update_count = stmt1.executeUpdate("insert into APPADM.DTL_ROAMING_OPERATOR_INVOICE VALUES (" + "'" + OperatorInfoList.get(8) + "','" + OperatorInfoList.get(1) + "',TO_CHAR(TO_DATE('" + Period + "','MON/yyyy'),'MON/yyyy'),TO_DATE('" + Invoice_processing_dt + "','DD/MM/YYYY')," + "'" + FileSummaryDetails.get(0) + "','" + FileSummaryDetails.get(1) + "','" + FileSummaryDetails.get(2) + "','" + FileSummaryDetails.get(3) + "','" + FileSummaryDetails.get(4) + "','" + FileSummaryDetails.get(5) + "','" + FileSummaryDetails.get(6) + "','" + FileSummaryDetails.get(7) + "','" + ... |
13. breaking up a string into chars forums.oracle.comI need to pass a String as a parameter to a method which will evalute its value based on values of all letters. I already have a scrabble class ready to calculate the value but I don't understand how to break up the string I pass as a parameter into individual letters? |
14. char cannot be dereferenced forums.oracle.com |
15. How to Handle Java String as Char* in Cpp forums.oracle.comWe r developing one application in that i am calling c++ function by using java. in c++ use char* to store java string. but in which its stores as 2 bytes per char because of this i am facing character handling problem So how do I pass String from java to C++ function ? |
16. Concatenation of 2 chars forums.oracle.com |
17. chars to strings forums.oracle.com |
18. java char declarations forums.oracle.com |
19. char dereferencing forums.oracle.com |
20. char forums.oracle.com |
21. char c = -1; forums.oracle.com |
22. How do I represent the apostrophe char in java? ''' doesn't work and ... forums.oracle.com |
23. char assignment forums.oracle.com |
24. Seperate a String to substrings which starts and ends with specified char forums.oracle.comhi, i want to seperate a String line for ex: "< |
25. char set to null? forums.oracle.comSo, I have no experience with using null, but the code I am working on requires char to be set to null, specifically values in a char array. According to the book I'm using, "null is a special constant that can be used to give a value to any variable of any class type". However, when I try to set an ... |
26. Separating chars forums.oracle.com |
27. chars += charArray ?? forums.oracle.comLet's start from the beginning. You make an char array and fill it randomly. So you end up with something like {'H', 'H', 'U', 'B', 'H', 'B', 'U', 'U', 'B', 'U', 'H', 'B'}. You then pass that array to the toChar method. What do you want that method to do? Please provide a full explanation using your best English so we ... |
28. Creating a String with repeated chars forums.oracle.com |
29. Position of occurences of a char in a string forums.oracle.comHi, I want to see the position of occurences of a character in a string. I also want to catch an exception if the string runs out. Here's what I have so far: If I run it using aprog 4 it should throw an exception since there is only 2 spaces. But it isn't throwing any exception. Any ideas why? String ... |
30. ctrl-p char in String forums.oracle.com |
31. Char forums.oracle.com |
32. eeeh, umm not really sure, what to name this. Using a char to include into forums.oracle.com |
33. char and Character forums.oracle.com |
34. same char[] ?! forums.oracle.com |
35. string to char forums.oracle.com |
36. Character.isUpperCase(char ch) function forums.oracle.com |
37. how to initialize a char? forums.oracle.com |
38. char limit forums.oracle.com |
39. Watching for char(27) forums.oracle.comOkay, I have some data coming from a live telnet connection through an inputStream. In telnet special handlers are excaped with 'char(27)[*m'. I need to know how to find that char(27), I don't know it's unicode equivalant sense it is ANSII. does anyone know how to do this? Would it just be \u0027? |
40. char to String forums.oracle.com |
41. Problem with single char forums.oracle.com |
42. combining chars forums.oracle.comI am trying to create an array of pairs of random letters. I have written a program that generates random integers between 65 and 90 and assigns them to (char)x and (char)y. I need to combine the two random chars so I have pairs like 'SE', 'XG', etc. How do I do that? |
43. Char in given set (condition) forums.oracle.com |
44. Char to String error forums.oracle.com |
45. need help with char sorting.. forums.oracle.comwell..i was given another program where i was suppoed to make this method of sort chars based on unicode..(e.g..if array is b, a ,c..it sorts a,b,c ) the reason why a temp variable is there is because i need it to store values from the array..since this is selection sort..the value with the greater number = temp..i hope u c my ... |
46. char cannot be dereferenced! forums.oracle.com |
47. scanning a char forums.oracle.comi dont think i can scan a single char, but here is my problem. System.out.println("Enter the tax category (N,L,M,or H): "); taxCategory = scan.next(); i know that i cant do that, but i need to know what i can do to temporarily switch taxCategory into a String. it has to stay as a char in the long run. im confused on ... |
48. char forums.oracle.com |
49. char to String forums.oracle.comI don't know why this is giving me so much trouble... but how do you convert a character into a string? Specifically I'm trying to use the charAt() from the String class and attach what it returns onto another string. It keeps giving me the "inconvertible types" error which I think is because it is a char and not a string. ... |
50. finding multiple occurences of a char in a string forums.oracle.comSo I am trying to make a check to see if there is more than one comma in an entry such as the following. "Johnson, Mr. Derrik J." I figured out that to make sure it has a comma can be... if (stringHolder[1].indexOf(",") > 0 == false) { System.out.println (""); System.out.println ("Error G"); } So to make sure there are not ... |
51. Evaluating chars in String forums.oracle.comThat's not what I meant at all. I just pointed out that there's no point in talking down to people just because they ask questions that appear stupid or silly. I realize now that I should have been able to solve my problem without posting it here, but then again this is a beginners forum, and I don't really see the ... |
52. Switch case with char forums.oracle.com |
53. Is there a String(char, ntimes) function ? forums.oracle.comI've read the api but I think there is not a mehod I'm looking for. Of course it can be substituted by for (int i=0;i<4;i++){a+=string("f")} or something similar As a wrote in the last message in VB there were a simple function that made it .... a = string("f",4) - >>>>>>> a = "4444" The goal is to have a simple ... |
54. if char in list of chars forums.oracle.comWhat's the best way to check whether a char matches one of a group of chars? Say I have char c = 'd' how should I check if a,b,c,d,e,f contains c? I can think of several ways to do this, but not sure which is most efficient in Java. 1. Create a char array and loop through to check each one ... |
55. char cannot be dereferenced forums.oracle.com |
56. char exception forums.oracle.comGenerally you do this sort of thing by pushing tokens onto the stack or popping them off, for left or right parentheses. If you try to pop an empty stack or if you reach the end of input and you have a non-empty stack, then you have unbalanced parentheses. It looks like you may have started down that road already with ... |
57. string won't accept a backslash char forums.oracle.com |
58. send string to main and tell how many uppcare char's.. forums.oracle.comIn answer to why the answer was 24 in the original code, this is a good time to develop your debugging methodology. One way of doing this is to pepper your code with System.out.println() statements to see exactly what its doing. Another is to set a breakpoint and single step through it. |
59. Conver String object into char forums.oracle.com |
60. Add char to string forums.oracle.com |
61. Detecting the first char inside string forums.oracle.comI guess you mean the first character of a particular type - excluding '@' and '#'. morgalr wrote: There isn't a built in function like String.firstChar() that would give you the first character of any String. You can easily make one though. There is [String.charAt(int index)|http://java.sun.com/javase/6/docs/api/java/lang/String.html#charAt(int)] which returns the character at position index. This method can't read your mind though, so ... |
62. Anybody knows the RANGE of Western chars? forums.oracle.com |
63. distinguish char x forums.oracle.comok ... I will try to explain it better... what i want to do is: 1st to write "3 + 5 - x" 2nd using stremtokenizer i want to do other things when the token is number (3 and 5) and other when the token is operator (+ , -) and finally to do other things when the token is x... ... |
64. Need help finding index of char in a string forums.oracle.com |
65. pop from stack and store to char? forums.oracle.comI am trying to write an infix to postfix prgm and when i compile i get: ListOperations3.java:143: incompatible types found : java.lang.Object required: char topOp = oStack.pop(); because apparently the built in stacks use generic objects as a return type and thats incompatible with char. How can i pop from the stack to a char? Here is a method where the ... |
66. char to uppercase? forums.oracle.comSorry, as corlettk correctly stated it was not intended as an attack at all. I just wanted to reinforce the notion that in production code this should never be hand-coded. Personally, I don't think too much of showing the old version as a learning tool, because it's bound to stay stuck in some peoples heads. Humans are notoriously good at ignoring ... |
67. String to Char forums.oracle.comThe requirement about converting String to char is not clear, since String is made up of multiple chars anyway you may just use charAt(0) to the get the char at first index position in the String and for converting char to String you do have the method in the API. refer the Character class, it has the toString method. Any way ... |
68. help to break a string into groups of chars???? forums.oracle.com |
69. Taking a char from a string forums.oracle.com |
70. char null problem forums.oracle.com |
71. Building a char forums.oracle.comHello. This is my first post. I started learning java a few days ago. It's not that hard because I have experience with C++ and PHP. I have the next problem: I need to build a name with the 2nd character of another 3 given names. I have a string with 3 names, i have to read the string, get the ... |
72. Using a string or char as a class when calling a method forums.oracle.com |
73. change my chars width forums.oracle.com |
74. Spelling char forums.oracle.com |
75. simple hack for Char instance forums.oracle.com |
76. Char help forums.oracle.com |
77. Char comparision forums.oracle.com |
78. char frequency forums.oracle.comImagine if you always had someone to do your homework for you all the time. You'd pass the course without knowing anything at all about the course itself. Better give students a chance to do their homework themselves and only point in the right direction when they have shown that they are putting some effort to solve the problem themselves. |
79. using char with switch cases forums.oracle.comI was hoping to use char instead of int for switch cases. I'd take input from System.in for a simple CLI interface. I'm a bad programmer who hasn't done it in a while so forgive me if I'm a little slow. I just can't get it to like the char's. What am I doing wrong...and I know the code is incomplete ... |
80. how to prevent Properties.store() to automatically escapes chars? forums.oracle.comWhy would you want to avoid it? If the escaping isn't done properly, then you won't be able to read the data later using Properties.load(). On the other hand, if you don't plan to use Properties.load() to read the data later, then don't use Properties.store() to write it. Like raychen says, design your own format if you don't like the format ... |
81. math calculation with char forums.oracle.com |
82. char frequency forums.oracle.comjerry6185 wrote: Hi everyone i am try to make program that counts the frequency of a character and shows it in the command line for example "Hello" h 1 e 1 l 2 o 1 but instead of printing that the program that i did just prints e 5 That should give you a huge clue as to where to look. ... |
83. help to break a string into groups of chars???? forums.oracle.com |
84. problem Using CHAR, help PLS forums.oracle.com |
85. get characters infront and after another char... forums.oracle.com |
86. String to char error forums.oracle.comhere is my code: it is giving me the error at the bottom can anyone help me out public void histogram() { int i, index, count; for(index = 0; index< oneline.length(); index ++) { if(oneline.lastIndexOf(oneline.charAt(index), index-1) > -1) for(count = 1, i = index + 1; i< oneline.length(); i++) { if(oneline.charAt(i) == oneline.charAt(index)) count++; } } System.out.println(oneline.charAt(index + " " + ... |
87. String to char error forums.oracle.com |
88. Returning a String for this method rather than chars forums.oracle.comFrom javadoc: An exception of type NumberFormatException is thrown if any of the following situations occurs: * The first argument is null or is a string of length zero. * The radix is either smaller than Character.MIN_RADIX or larger than Character.MAX_RADIX. * Any character of the string is not a digit of the specified radix, except that the first character may ... |
89. String to char issue... forums.oracle.com |
90. NullPointerException when taking 1 char from a string... forums.oracle.comI've figured out the problem - it was the while loop doing all the reading - it would read all the records in the file fine until it got to the end - because I didn't assign readLine() to line at the end of the while loop it would go round once more and try to make a char from a ... |
91. char cannot be derefferenced forums.oracle.com |
92. Fastest way to access data between String and char[] forums.oracle.comHardware is cheap when compared to programming effort. I worked on a program for dealers at a bank in London where the dealers said the program was far too slow. The problem was the architecture, the cheapest solution was to buy each of the dealers the fastest Spark on the market. This satisfied the dealers. |
93. *very stupid* question about char[] to String. But please help!!! forums.oracle.com |
94. return lines of no more than ten chars each forums.oracle.com1) In order for code tags to work, the code must be formatted correctly to start with. Kind of makes sense, doesn't it? 2) don't start a new thread for this. Keep all posts relevant to a single question in one thread. Not doing so constitutes cross-posting and will get you and your questions shunned. |
95. return lines of no more than ten chars each forums.oracle.com |
96. Simple strings and char problem forums.oracle.comreturn j; } ******************* Test class // main method Scanner myScan = new Scanner(System.in); System.out.println("Type in a sentence: "); String input = myScan.next(); mySTester.print(mySTester.messageToInt(input)); ******************* Basically takes a string, gets each character, gets its ascii value, converts it to an int, adds it to an array. So if you run the test class and type in "aa" it will return "97 ... |
97. Adding chars to strings forums.oracle.comIf you want to put it at the start or end then just concatenate the char. If you want it somewhere in the middle then you will need to use substring and concatenation. As mentioned above Strings are imutable so you will need to assign the result to another String variable. Edited by: Quacked on Nov 23, 2007 10:27 AM |
98. void f(char* charPointer) { free(charPointer); } forums.oracle.com |
99. how to solve request.getParameter when the parameter has a '%' char? forums.oracle.comExcuse me warnerja...I am not leading anyone down anypath. He is always free to try the method you suggested and if it works I will be more than happy. I chipped in because I had faced the exact same problem before and was able to solve it using only the URLDecode. Rather than trying to have a go at me if ... |
100. how to delete char index. forums.oracle.comHello everyone I am having bit of problem to remove an index of letters[] (char array) the letters [] consists of letters from a-z..i.e. letters[0]= a letters[1]=b ..... and so on now I have a method which has param of char void public String unGuessedLetters(char letter) { String str; for(int i=0;i<=25;i++) { if(letter==letters) { letters.deleteCharAt(i); str= new String (letters); } return ... |