[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

rhino java, javascript,   converting asc code to character value, but the compiler keeps complaining that "charCodeAt" is not found !

Posted on 2016-10-20
3
Medium Priority
?
133 Views
Last Modified: 2016-10-21
Trying to read a file in JavaScript by referencing the java libraries directly, but it returns an integer for each character.

I need to convert the integer to a char value, but the compiler states that "charCodeAt(..." is not found in the String object.

Any help is appreciated.

or an easier way of just reading the text of a file ...

Thanks
0
Comment
Question by:sidwelle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 59

Accepted Solution

by:
Julian Hansen earned 1000 total points
ID: 41853426
Can we see some source code?
0
 
LVL 16

Assisted Solution

by:krakatoa
krakatoa earned 1000 total points
ID: 41853610
In mainstream Java, codePointAt(int index) in the String class returns an int, and charAt(int index) returns a char.
0
 

Author Closing Comment

by:sidwelle
ID: 41854247
Thanks for answering, Got it to work. I am working w/an undocumented version of Java inside of another product, so I don't have any documentation or any examples, but I get it to work.  Once I played around long enough with the definitions:

            var reader = new java.io.FileReader(file);      
            var sb = new java.lang.StringBuilder;
      
             while ((c = reader.read()) != -1)
             {
                   sb.append(String.fromCharCode(c));
            }
      
            if (reader != null) {
                  reader.close();
            }
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question