Character, int value and radix

I'm iterating through strings testing for ASCII characters > 127 (e.g. in MS Word, typing in "..." creates a single character of 3 dots (ASCII 133)).
When I use Character.digit(char, radix) and a character > 127 is found, -1 is returned. But I need to find out what the ASCII value is when it's > 127. I'm not clear on how to use the radix value and my searches on the web have only made it murkier. Anyone who can help me clear this up would be greatly appreciated.
Thank you
Tom Berry

I want to find the actual ASCII value to remap it to a usable ASCII character(s) < 127. For example, type 3 periods "..." in MSWord. It will automatically change to ASCII 133. When a user cuts and pastes text from MSWord to one of my web apps, and the data is saved to SQL Server, any of these 'MS' characters > 127 becomes a "?" when it is retrieved and displayed on a HTML page. I'm trying to intercept this text and correct the characters.
I'm currently doing the following:
a. Character.getNumericValue(char) == -1,
b. Create a new Character object of the char,
c. The method .hashCode() gives me the Character's ASCII value,
d. If > 127 (CR, LF, SPACE, etc are also caught in this), I pass the ASCII value to a HashMap which returns the correct character.
This seems to inefficient. I was hoping to be able to get the ASCII value at step a. and so not be creating new Character objects each time the NumericValue == -1.

Similar Messages

  • Get every 10 sec a int.value and need to take the sum of the last 18 values

    Hi,
    i get every 10 sec a int.value and need to take the sum of the last 18 values (3 minutes).
    the programm should work permanently.
    I tried with a 1d-array but didn´t get a result. Could anyone help me?
    Best regards
    kasche

    Use the example in the posted link, then add another shift register for your sum of all elements. Dont add all the elements every time, add them to a running total when they come in. You will need to evaluate how big this number is going to get, however, and decide if you should use an I64 for your running total of all elements. Even this will overflow eventually. 
    So your code would look like that posted by GerdW in the above link, then add a shift register with a starting value of 0. Then add your input value to the value comming from this shift register and send the output to the shift register's output terminal. This creates your running total of all values. The code by GerdW provides your "last 18 elements" total in a very efficient manner, just change the 15 to an 18.
    I have attached a sample bit of code to make it clear. I saved it in LV 8.0 so more people can open it.
    CyberTazer
    Software Systems Engineer
    Attachments:
    Running 18 total.vi ‏11 KB

  • Sorting array double or int value and keeping the associated identifier.

    Hi,
    How would I sort an array which contains a double or int value (I know how to do that) but I also want to keep the unique identifier which is associated to array element after the array has been sorted:
    example:
    identifier: 15STH7425042735
    double: 742500.000
    Thanks,
    John J. Mitchell

    Please define an it in form of entity first and then think of operating on structured data.
    a better approach here would be please create an instances of appropriate structured data arrange them in form of a list and then apply specified logic on them
    here is an example which you might think of implementing it and would more appropriate as per your stated requirements.
    public class SampleBean implements Serializable{
       private String uniqueIdentifier = new String();
       private double appValue = 0.0;
       public void setUniqueIdentifier(String uniqueIdentifier){
           this.uniqueIdentifier = uniqueIdentifier;
       public String getUniqueIdentifier(){
          return this.uniqueIdentifier;
       public void setAppValue(double appValue){
              this.appValue = appValue;
       public double getAppValue(){
            return this.appValue;
    }Sample Comparators:
    Comparator comparator4AppValue = new Comparator(){
          public int compare(Object obj1,Object obj2){
                  return Double.compare(((SampleBean)obj1).getAppValue(),((SampleBean)obj2).getAppValue());
    Comparator comparator4UniqueIdentifier = new Comparator(){
          public int compare(Object obj1,Object obj2){
                  return ((SampleBean)obj1).getUniqueIdentifier().compareTo( ((SampleBean)obj2).getUniqueIdentifier());
    };Assuming that you have acquired an Array or List 'N' Elements of SampleBean with appropriate values.
    the belows is the method of how to sort specified Array/List
    In case of array
    SampleBean sb[] = this.getSampleBeansArray();
    // in order to sort using double value inside SampleBean array.
    Arrays.sort(sb,comparator4AppValue);
    // in order to sort using unique Identifier value inside SampleBean array.
    Arrays.sort(sb,comparator4UniqueIdentifier);In case of a list
    List sb = this.getSampleBeansList();
    // in order to sort using double value inside SampleBean array.
    Collections.sort(sb,comparator4AppValue);
    // in order to sort using unique Identifier value inside SampleBean array.
    Collections.sort(sb,comparator4UniqueIdentifier);Hope this might give you some idea of how to go about.:)
    REGARDS,
    RaHuL

  • Producing a line graph of int values and saving as an image

    Hi,
    I wonder if anyone could help me with this. I have 2 arrays of integer values that I would like to plot as a line graph (e.g. X[ ] and Y [ ]) and then have this line graph saved as an image (the format isn't too important but PNG would be preferred).
    Could somone point me in the right direction of an easy way to do this?
    Thanks,
    Pete

    Have a look at the following classes :
    java.awt.Graphics (drawLine method)
    java.awt.Image
    java.awt.BufferedImage
    javax.imageio.ImageIO (jdk 1.4+)

  • Can't read int value

    import java.io.*;
    class binary
         public static void main(String args[])
              BufferedReader br;
              int ch=0;
              br = new BufferedReader(new InputStreamReader(System.in));
              System.out.println("enter value");
              try    
                   ch = (int)br.read();
              catch(IOException e)
                   System.out.println("Exception Caught");
              System.out.println("the value entered is :" +  ch);
    }the read method used above reads an character and returns it integer value and if we want to read an integer value how to do so, i tried it in the above code but it doesn't work
    is there any specific function for reading int values or we need to use the ByteStream classes instead of the Character ones
    plz reply

    thanks it worked
    i read my number using the readLine() method as a
    String and then converted it back to an int value
    ut is there no method by which i could read values as
    int from the console n not have to do the conversion
    part.plz heply guys

  • Need help to convert this format of string in a int value?

    public static int isNumber( String number, int defaultValue ) {
              int result;
              try {
                   result = Integer.parseInt(number);
              } catch( Exception e ) {
                   result = defaultValue;
              return result;
         }Hi, I have the above method that converts a string Number into a int value. It works fine if the string is a normal number 234 (without spaces) but I have a string in the following format:
    *(space)�23,000(space).*
    That is I have a "space" then a "Pound" sign then two numbers then a comma followed by three numbers and then a space again.
    Is there any way I can convert this format into a simple int value?
    Thanks for any guidance.
    Zub

    Hi, I tried the following code but it don't seem to work
         public static int isNumberTrimSpaces( String number, int defaultValue ) {
              number.trim();
              String parsed = "";
              for (int i = 0 ; i < number.length() && number.charAt(i) != ',' ; i++)
             if (Character.isDigit(number.charAt(i))) {
             parsed += number.charAt(i);}
              int result;
              try {
                   result = Integer.parseInt(number);
              } catch( Exception e ) {
                   result = defaultValue;
              return result;
         }Any Ideas? Also will the loop get rid of the pound sign?

  • Getting int values from a char array

    Hi,
    I need to make a fast program which reads lots of data from files and process them. I need to interpret these data as int's. To be more efficient and avoid to make a lot of disk access, I allocate in memory buffers part of the data, then process it and then allocate new data. The problem is that if I want to allocate data in memory buffers, all the methods that enables me to do that receceive as a parameter only a an array of chars, and as I have mentioned I need to interpret the data as a 4 bytes int. The static methods of Array to get the int value from a position ar not useful because the onlye get the int value of the indexed byte (or char); this method doesn't take 4 bytes from the index to build an int.
    My question is: is there any way to build an int from 4 bytes? or can I get the int's in this way directly from the buffer?
    Thank you,

    Isn't this one of the prime examples of using java.io.DataOutputStream and java.io.DataInputStream?

  • Error while running Configuration Wizard in SharePoint 2013: Exception in RefreshCache. Exception message :The '?' character, hexadecimal value 0x43A0, cannot be included in a name. Line 1, position 5694.

    Hi Friends,
    I was trying to run configuration wizard in SharePoint 2013 Central Administration and I got below error:
    Exception in RefreshCache. Exception message :The '?' character, hexadecimal value 0x43A0, cannot be included in a name. Line 1, position 5694.
    Yesterday my SharePoint server was running fine and today when I try to update a SharePoint solution (wsp) I got same error. Even if I try to do any operation
    in Central administration like adding new WSP, Updating WSP , I get same error.
    Does any one have any Idea?
    Regards
    Gireesh Painuly

    Posted this a few weeks back - would appreciate any suggestions?
    Thanks,
    Carl

  • Sharepoint 2007 list error - The '}' character, hexadecimal value 0x7D, cannot be included in a name. Line 1, position 440.

    Hi Everyone,
    We have a sharepoint 2007 deployment which in general has been fine since it was built.  
    Version is 12.0.0.6421 (MOSS 2007 SP2 (KB953334 & KB953338))
    on a Windows 2003 R2 SP2 server.
    We created a list a while back to store information for our servers but for some reason it now has an error.
    the symptoms are:
    1) Navigating to the list and choosing any view (a few custom views), we can see the data fine
    2)  Creating new items or modifying existing items brings up:
    An unexpected error has occurred.
    3) Trying to access the list settings brings up:
    An unexpected error has occurred.
    4) Using "view all site content" and clicking on the list brings up:
    The '}' character, hexadecimal value 0x7D, cannot be included in a name. Line 1, position 440.
    I've attempted to search for the error online but the error doesn't bring back anything specific to Sharepoint.
    My gut feeling is either a corruption of the list or a user has entered an invalid character in one of the list entries, but I cannot amend the list in any way.
    Ordinarily I would advise the user to re-create the list and enter the information from scratch, however this list contains alot of information and is crucial to the server teams documentation.
    Does anyone have any ideas on where I should be focusing my search efforts?  I did check the logs and couldn't see any obvious entries for this list.
    Any assistance would be greatly appreciated.
    Cheers,
    Carl

    Posted this a few weeks back - would appreciate any suggestions?
    Thanks,
    Carl

  • Comparing a single int to more than one int value?

    Hi is there a way to compare a single int value amongst several ints in one go?
    i know i could do if statements that can compare each int one by one but i was wondering if there is an easier way? like comparing all values amognst eachother
    somthing like
    int i;
    int a,b,c,d,e,f,,g;
    //ints a-g assigned some random numbers
    if(i == a,b,c,d,e,f,g)
          //do somthing here
    }

    i found out a way. i tried this way by using nested for loops and an if statement that compares every single value amongst eachother
    for(int q=0; q < 5; q++)
                ran[q] = (int)(java.lang.Math.random()*52);
            for(int x = 0; x < 5;x++)
                for(int z = 0; z < 5; z++)
                    if(x != z && ran[x] == ran[z])
                        ran[x] = (int)(java.lang.Math.random()*52);
            }

  • No net value and quantity in the DSO

    Hi Gurus,
    I would like to ask questions related to SRM Data sources. In the SRM data source 0BBP_TD_SC_1 related to shopping carts, we have the concept of GUID.
    Here for main SC number there is a GUID, but for item level there is a different GUID. While uploading the data into DSO what is happening is that the net value and quantity value is coming as zero, since it is picking value from SC GUID which has the SC qty and Value as zero instead of Item GUID which actually has this data....
    I am not sure whether anyone has faced this issue and how it can resolved. I have already in rule details of transformation made the Summation as the criteria..
    Thanks and Regards
    Abhi

    You must be moving somewhere in between a character type 1,000.00 to a numeric type variable and hence the error because of the ','. Check this.

  • Limiting entry in a JTextField to numeric value and "%" value

    Hi,
    I want to allow the user to enter numeric value and % value
    How can I limit the user to make such a entry in JTextField

    Use the code given below to make your textfield accept only numeric values. You can modify itto include % values too.
    textField.setDocument( new TextFieldVerifier() );     
    class TextFieldVerifier extends PlainDocument {
    public void insertString( int offset, String str, AttributeSet attSet ) throws BadLocationException {           
    boolean valid = false;          
    if ( str == null ) {
    return;
    String old = getText( 0, getLength() );
    /* insert the new string at the given offset, into the old string */     
    String newStr = old.substring( 0, offset ) + str + old.substring( offset );
    try {
    /* check if the new string is a valid integer */
    Integer.parseInt( newStr );               
    valid = true;
    } catch ( NumberFormatException ne ) {          
    /* invalid, if not an integer */
    valid = false;
    Toolkit.getDefaultToolkit().beep();           
    if ( valid ) {
    super.insertString( offset, str, attSet );
    }

  • How to display values and new char line (blank line)

    Hi,
    In database, one field contains values followed by new character lines (blank lines) after blank lines there is no values. Finally, I would say the field contains values and blank lines. Every thing is fine in database.
    In Crystal Reports the field is displaying only values. Need to display values and blank line.
    User is asking after values new character lines (blank line) to be shown. They enter like that in an application. The user doubt is why report is not showing what they enter in the application.
    In detail explanation, front end tool is ASP.NET and backend is SQL Server.
    User enter some values in note field, after that they hit enter button in the same field, cursor will go next line...user may hit u2018enter buttonu2019 more than 5 times. So note field contain values and some blank lines which are created by after hitting enter button.
    If user opens the application, they could see values plus blank lines in the note field.
    They are fine with the application.
    In Crystal Reports, the note field shows only values.
    User is questioning that why we could not see in report we enter.
    I checked in .Net application and SQL server database it is fine. It is displaying values and blank line.
    Please help me out how to display values followed by blank lines in Crystal Reports - the way they enter in the application.
    Thanks and Regards,
    Manjunath N. Jogin

    Hi,
    Sharonmat,
    I tried as you suggested. It is still displaying only values.
    I would like to explain again.
    it is not exactly null values.
    In .Net application it is called 'new char line'.
    it shows those many lines look like null.
    it is working fine in database.
    Why it is not working in Crystal Reports? I am wondering...
    Thanks for your suggestion.
    Debi,
    User may enter any number of blank lines or they may not enter blank lines.
    That is the reason I can not always give more height or blank text object.
    Thanks for your suggestion.
    Please suggest me some more suggestions,
    Thanks and Regards,
    Manjunath N. Jogin

  • Constant values and encapsulation

    Hi All,
    lookat the code below:
    class Test{
    public static final int flag = 10;
    Public static void main(String args[])
    System.out.println(i);
    }here the constant value i is used inside the same class.
    Now generally, we use to make separate java file for all constant values and get the values:
    For example:
    class UIConstants{
    public static final int flag = 10;
    }and call this constants values where ever neccessary:
    class Test{
    Public static void main(String args[])
    System.out.println(UIConstants.flag);
    }In most of the the time, i have seen second case is used, but it avoids the encapsulation concepts, since making variable private to public.
    What is the advantages of making in this way?or is there any other reason for using this way?

    Are they thread-safe? No! Not by default anyway.Anything immutable and final is thread safeAs long as the immutable object really is internally
    immutable and has no operations that have
    side-effects on objects outside of the object.
    COuld you shed some light on this.
    For example even a final immutable PrintStream (which
    system.out and system.err are not... see
    System.setOut()) is not necessarily threadsafe
    because two threads could be writing to the same
    stream at the same time.I didnot know PrintStreams were immutable

  • How to divide two int numbers and get a fraction ?

    I am dividing two int numbers and the result should be a fraction but I am always getting a zero
    set @result= @num1/@num2  
    when num1=50 and num2=100

    I am dividing two int numbers and the result should be a fraction but I am always getting a zero
    set @result= @num1/@num2  
    You can either one of the values as a decimal or float type, or just multiply one of the values by 1.0.
    set @result= @num1/@num2*1.0
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

Maybe you are looking for

  • Fails to start

    Hello, I have recently been having difficulty with two of our ARD Admin stations. The entirety of the networks in question are 10.4.10 with ARD 3.1 and are all PowerPC. When the Admin station (PPC iMac) tries to launch ARD we get the dialog that basi

  • Itunes videos file type?

    I purchased a few videos of "the office" season 2 from Itunes and want to burn them onto a DVD. What type of file are they (mp4, mov, mpeg, etc) so that i can format the conversion correctly for burning. Thanks!!!

  • Not entirely happy with infinity 2

    I was previously with sky, and upgraded to their fibre unlimited when it became available. Ended up getting 30Mbps out of possible 40Mbps. I had been told at time of upgrade, that at a later stage if I wanted to upgrade to pro I would be able to. Cal

  • Bridge CS4 - Lost all file associations - On 2 computers

    I run Photoshop CS4 on my desktop and notebook, Windows XP Pro. I have lost all my file associations with bridge CS4.  If I clicked on a .jpg MS paint would start up.  It use to work before no problem.  If I reset, it does nothing.  This is happening

  • Updated to IOS 8 and now power button does not respond and screen is frozen with apple logo.

    Updated iPad to IOS 8 -- screen locked.  Now screen is frozen with apple logo and the power button is not responding. Thanks for any help!