| | |
Character's Unicode Value
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jun 2006
Posts: 4
Reputation:
Solved Threads: 0
Hey, I'm a beginner programmer and have been grinding my teeth over this one specific part of my program for hours and have finally admitted to myself that I need help.
Here's the problem:
I have to write an encryption function that is simply the sum of the unicode values of all the letters in a word, multiplied by the product of the unicode values of the FIRST FIVE letters in the word, modulus 1459303249. The words below are what I was given to check that my function was working properly.
(this I used just to test & make sure the word "hello" would come out to the right number):
It returned a huge, negative number. I have a feeling that I'm mixing things up or otherwise overlooking something simple. Any tips would be greatly appreciated!!
Here's the problem:
I have to write an encryption function that is simply the sum of the unicode values of all the letters in a word, multiplied by the product of the unicode values of the FIRST FIVE letters in the word, modulus 1459303249. The words below are what I was given to check that my function was working properly.
- hello : 1205468819
- goodbye : 312635099
- hello27 : 502523728
- eybdoog : 1200983286
(this I used just to test & make sure the word "hello" would come out to the right number):
Java Syntax (Toggle Plain Text)
long a = ('h' + 'e' + 'l' + 'l' + 'o') * ('h' * 'e' * 'l' * 'l' * 'o')% 1459303249;
I think it would be more intutive to create a function such as:
And then to separate your string into chars using the function tochar().
Java Syntax (Toggle Plain Text)
if a then unicode = 97 end if if b then unicode = 98 endif
And then to separate your string into chars using the function tochar().
*Voted best profile in the world*
![]() |
Similar Threads
- How to Remove Newline character from a VB String (Visual Basic 4 / 5 / 6)
- Multi-character support (C++)
- Escape and Unescape / Handling (C)
- How to use wifstream to read a unicode file.. (C++)
- Handle unicode characters (Python)
- Python and Unicode (Python)
Other Threads in the Java Forum
- Previous Thread: Limiting numbers displayed, under a user given value
- Next Thread: vector, put out sorted list
| Thread Tools | Search this Thread |
-xlint android api applet application array arrays automation bi binary blackberry block bluetooth chat class classes client code compile compiler component database developmenthelp eclipse error exception fractal freeze functiontesting game gameprogramming givemetehcodez graphics gui html ide image input integer j2me j2seprojects java javac javaprojects jetbrains jni jpanel jtable julia learningresources lego linux list login loop loops mac map method methods mobile myregfun netbeans newbie notdisplaying number online page print problem program programming project qt recursion scanner screen server set singleton size sms sort spamblocker sql string swing system template textfields threads time title tree tutorial-sample update variablebinding windows working xor






