Number representation of a string..

Hi all,
I want to get a number representation of a string. The string could be anything.
I do not need to be able to convert it back.
How can I do this?
No length or adding up the char codes is not good as ABD would be the same as BAD etc.
Well - A hash would do.
I've just found get_hash_value so that may be sufficient.
Edited by: user10071099 on Jun 17, 2009 10:02 AM

You could use rawtohex function for that ( or , if there should be no relation between string content and the number - you can use any of popular hash functions , such as sha1 or md5)
Best regards
Maxim

Similar Messages

  • Server 2012 errors for timeout -- LDAP error number: 55 -- LDAP error string: Timeout Failed to get server error string from LDAP connection

    Hello, currently getting below error msg's utilizing software thru which LDAP is queried for discovering AD objects/path and resource enumeration and tracking.
    Have ensured firewalls and port (389 ) relational to LDAP are not closed, thus causing hanging.
    I see there was a write up on Svr 2003 ( https://support.microsoft.com/en-us/kb/315071 ) not sure if this is applicable, of if the "Ntdsutil.exe" arcitecture has changed much from Svr 03. Please advise. 
    -----------error msg  ----------------
    -- LDAP error number: 55
    -- LDAP error string: Timeout Failed to get server error string from LDAP connection

    The link you shared is still applicable. You can adjust your LDAP policy depending on your software requirements.
    I would also recommend that you in touch with your software vendor to get more details about the software requirements.
    This posting is provided AS IS with no warranties or guarantees , and confers no rights.
    Ahmed MALEK
    My Website Link
    My Linkedin Profile
    My MVP Profile

  • What api would I use to get the number of chars in string?

    What api would I use to get the number of chars in string?

    Assuming that you really mean that you want the number of charaters in a String (not string), that would be documented in java.lang.String
    The method is length()

  • Xml representation of a string

    hi all,
    how do i make an xml representation of a string..if anyone knows please post it.
    thanks

    wow, you guys must be all in the same class, that's 3 times this question has been asked. Look below...

  • Parsing a parenthetic representation of a string to tree

    I have a little assignment and I have no thoughts at all anymore. I must convert a string ( like A(B,C) or A(B(C,D), E(F)) ) that represents a left-representation of binary tree. I must convert into a object and after that turn it around - I must make a right-representation of a string from object.
    I made a class below:
    import java.util.*;
    public class kodutoo_5 implements Enumeration<kodutoo_5> {
         private String name;
         private kodutoo_5 firstChild;
         private kodutoo_5 nextSibling;
         kodutoo_5(String n, kodutoo_5 d, kodutoo_5 r) {
              setName(n);
              setNextSibling(d);
              setFirstChild(r);
         kodutoo_5() {
              this("", null, null);
         kodutoo_5(String n) {
              this(n, null, null);
         public String getName() {
              return name;
         public void setName(String name) {
              this.name = name;
         public kodutoo_5 getFirstChild() {
              return firstChild;
         public void setFirstChild(kodutoo_5 firstChild) {
              this.firstChild = firstChild;
         public kodutoo_5 getNextSibling() {
              return nextSibling;
         public void setNextSibling(kodutoo_5 nextSibling) {
              this.nextSibling = nextSibling;
         public String toString() {
              return getName();
         public boolean hasMoreElements() {
              return (getNextSibling() != null);
         public kodutoo_5 nextElement() {
              return getNextSibling();
         public Enumeration<kodutoo_5> child() {
              return getFirstChild();
         private static kodutoo_5 addChild(kodutoo_5 parent, kodutoo_5 current, String nodeString) {
              kodutoo_5 result = current;
              //kui alluvaid ei ole, siis jarelikult juurtipp
              if(parent.getFirstChild() == null) {
                   //lisame alluva
                   parent.setFirstChild(new kodutoo_5(nodeString));
                   result = parent.getFirstChild();
              //alluvaid on
              } else {
                   result.setNextSibling(new kodutoo_5(nodeString));
                   result = result.getNextSibling();
              return result;
         public static kodutoo_5 parseTree(String s) {
              kodutoo_5 emptyRoot = new kodutoo_5();
              parseTree(emptyRoot, s);
              return emptyRoot.getFirstChild();
         private static void parseTree(kodutoo_5 parent, String s) {
              kodutoo_5 current = null;
              StringTokenizer st = new StringTokenizer(s, "(),", true);
              StringBuilder sb = new StringBuilder();
              while(st.hasMoreTokens()) {
                   String element = st.nextToken();
                   if(element.compareTo("(") == 0) {
                        if(sb.length() > 0) {
                             current = addChild(parent, current, sb.toString());
                             sb = new StringBuilder();
                   } else if(element.compareTo(")") == 0) {
                        if(sb.length() > 0) {
                             current = addChild(parent, current, sb.toString());
                             sb = new StringBuilder();
                   } else if(element.compareTo(",") == 0) {
                        if(sb.length() > 0) {
                             current = addChild(parent, current, sb.toString());
                             sb = new StringBuilder();
                   } else {
                        sb.append(element);
              if(sb.length() > 0) {
                   current = addChild(parent, current, sb.toString());
         public String rightParentheticRepresentation() {
              StringBuilder sb = new StringBuilder();
              //kontrollime kas juurtipp eksisteerib
              if (getName() == null) {
                   throw new NullPointerException("Puud ei eksisteeri!");
              //kontrollime ega juurtipp tuhi ei ole
              if (getName() == "") {
                   throw new RuntimeException("Puud ei eksisteeri!");
              //juurtipp eksisteerib, jarelikult ka puu
              if (getFirstChild() != null) {
                   sb.append("(");
                   sb.append(getFirstChild().rightParentheticRepresentation());
                   Enumeration<kodutoo_5> child = child();
                   while (child.hasMoreElements()) {
                        sb.append(",");
                        child = child.nextElement();
                        sb.append(((kodutoo_5) child).rightParentheticRepresentation());
                   sb.append(")");
              sb.append(getName());
              return sb.toString();
         public static void main(String[] args) {
              String s1 = "A(B,C)";
              //String s2 = "A(B(C,D),E(F))";
              kodutoo_5 t1 = kodutoo_5.parseTree(s1);
              //kodutoo_5 t2 = kodutoo_5.parseTree(s2);
              String v1 = t1.rightParentheticRepresentation();
              //String v2 = t2.rightParentheticRepresentation();
              System.out.println(s1 + " ==> " + v1);
              //System.out.println(s2 + " ==> " + v2);
    }But I can't make it right. Can anybody help me out to make this code work, please? Or point me what I'm doing wrong here?

    Add debugging statements to your code to see what it's doing and where it's going wrong.

  • Find number of lines a string will wrap to?

    I'd like to find the number of lines a string will wrap to, given a font and a width.
    Is this possible?
    Thanks

    You could get the height of resulting string using sizeWithFont:constrainedToSize, and then divide it by the height of one line (computed using the saem function with jsut one letter).

  • Needed program unit to translate number as currency to string

    HI All,
    Can you please tell me if there is existing program unit that i can use to translate number as currency to string
    Ex:
    i have numbeer like 110.5 and currency code EGP
    i need the program unit to return
    Only One Hundred Ten Egyptian Pound (s) and Fifty Piaster (s)
    for ococourse if the EGP is USD it'll return dollar instead of egyptian pound
    Thanks you

    Yeah i already did so and i got the function and used it my problem just in the currency translation for decimals
    that means when i need to translate 100.5 EGP
    one hundred Egyptian Pounds and fifty piasters
    i can now translate to one hundred Egyptian Pounds and fifty but what about the piasters
    i think i had to create a table that contains a currency code and the corresponding currency translation piasters , cents , ...etc
    so i think i'll have to search on google about the currency transaltion for the decimal point currency i hoped there is a tabke in the e-business suite contains it as it exists for the currency code

  • What is LV c code representation of NULL string

    I know that through .so/.dll code the representation of any string is a structure of the length followed by the characters, I allocate a long blank string in the LV code and copy over my strings in the .so/.dll and that works fine. How do I return a LV NULL string?

    dgholstein wrote:
    > I know that through .so/.dll code the representation of any string is
    > a structure of the length followed by the characters, I allocate a
    > long blank string in the LV code and copy over my strings in the
    > so/.dll and that works fine. How do I return a LV NULL string?
    As long as LabVIEW is not supporting 64 bit platforms a NULL pointer is
    really just a 32 bit integer with the value 0.
    So if you want to call a dll/so function which allows for a NULL pointer
    as parameter, you configure that parameter to be a signed or unsigned 32
    bit integer and wire the value 0 to its input.
    As to the LabVIEW string itself if you call a DLL it is usually better
    to use a C string type instead of the native LabVIEW handle. Once you
    use a LabVIEW handle t
    hat DLL really is difficult to use in other
    environments than LabVIEW.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Number Representation

    hi,
    I wanna to know the below number representation.
    0x00 5C00
    5C00 0C00
    5C00 5C00
    0C20 2020
    2020 2020
    2020 2020
    2020 2020
    2020 2020
    2020 2020
    20

    hi,
    Initially: Number representaion?
    0x00 5C00 5C00 0C00 5C00 5C00 0C20 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 20
    After Coversion: NUmber representation?
    0x30 3530 3530 3030 3530 3530 3030 3230 3230 3230 3230 3230 3230 3230 3230 3230 3230 3230 32
    i want know initial number representation and after conversion number representation. Please any one help me

  • Number of character in string

    Hi,
    How to Find number characters in a string.(not length), The string contains characters of english ,japanese & numericals also.
    Iam splitting the string by 2 length through FM 'split_text' and the and how to find the splitted part has japanese character or english character.
    \[removed by moderator\]
    Regards,
    Narasimhulu P
    Edited by: Jan Stallkamp on Jul 11, 2008 10:36 AM

    Hi Narasimhulu,
    There is System field called sy-abcde which conains all the English letters.
    If your string contains only english and Japanees chars,
    You can check with SY-ABCDE like below.
    DATA:
       w_urstring TYPE STRING.
      w_urstring = 'こんにちは。 Konnichiwa'.
      if  w_urstring ca sy-abcde.
        split  w_urstring into  w_urstring1  w_urstring2.
        if sy-subrc eq 0.
         write:
           /  w_urstring1, w_urstring2.
         endif.
    endif.
    hope this solves ur proble.
    Regards, 
    Rama chary.

  • Retreiving number and characters from string

    Hello fellow developers,
    Lets say i have the following string ER686 and want to split the string into a number and characterpart resulting in a String "ER" and an int "686". What is the best approach to accomplish this?
    Thank you for any help offered.

    The format is that there's a sequence of strings 2 or
    3 and a squence of numbers 3 or 4You might use a Pattern matcher, using a regular expression like the following :"(\\D{2,3})(\\d{3,4})"This expressions represents "two or three non-digit characters followed by 3 or 4 digits". The parenthesis are here to allow getting the two elements (groups) separately.
    Use the find() method of the matcher, then retrieve the two groups with group(1) and group(2).
    Eventually, parse the latter if required.

  • [CS3][JS] How to turn negative number in array into string

    Hello,
    I have a script that compares the array of the geometric bounds of all text frames to the margins for a document (all pages having the same margins). Any frames that do not match the margins are flagged.
    In order to compare the array of text frame geometric bounds to two arrays of margins (because they are facing pages), I have to convert the numbers to strings.
    My problem is that in the following snippet of code that creates the two margin arrays, the negative of the variables become numbers again. This would not be too difficult to solve except that all the numbers have to be 4 decimal points before converted to strings.
    Thanks,
    Tom
    var myDoc = app.activeDocument;
    var marginY1 = myDoc.pages.item(0).marginPreferences.top.toFixed(4);
    var marginX1 = myDoc.pages.item(0).marginPreferences.left.toFixed(4);
    var marginY2 = (myDoc.documentPreferences.pageHeight - myDoc.pages.item(0).marginPreferences.bottom).toFixed(4);
    var marginX2 = (myDoc.documentPreferences.pageWidth - myDoc.pages.item(0).marginPreferences.right).toFixed(4);
    var marginsRHand = [marginY1, marginX1, marginY2, marginX2];
    var marginsLHand = [marginY1, -marginX2, marginY2, -marginX1];

    Well, I think I have solved it. But I don't know why this solves it.
    I would think that in the above script all the variables would be numbers and not strings. But the data browser says they are strings.
    The solution is:
    var marginsLHand = [marginY1, Number(-marginX2).toFixed(4), marginY2, Number(-marginX1).toFixed(4)]
    If someone can explain why now all variables in the arrays are strings and not numbers, I'll be happy.
    Tom

  • Trying to determine the last occurence of a number within a word string.

    Hi All,
    I am trying to find the last occurence of a number within a string. I have had a quick look at the Java Tutorial and know about lastIndexOf and substring. The thing is I have to test for the existance of the numbers 0-9 within a product code that typically looks like this:
    s1_14G12B
    s1_17G1BA
    s2_24GD
    The only part of the above strings that I am interested in is the letter(s) that follow the very last number, so in the case of those codes presented above, I would like to extract the following:
    B
    BA
    D
    I have written some code that performs a similar operation:
    public class FindPriceCode
      private String priceCode;
      private String[] numberValues = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
      public FindPriceCode()
        priceCode = "s2_71G4BA";
        for(int i=0; i<numberValues.length; i++)
          int location = priceCode.lastIndexOf(numberValues);
    System.out.println("Character " + numberValues[i] + " found at position: " + location);
    public static void main(String[] args)
    FindPriceCode myPriceCode = new FindPriceCode();
    ...finding the location of numberValues string within the given example code. I am now at a loss as to how I can determine the location of the last number occurence (moving right to left) and then build a substring from that number. Any help will be greatly appreicated.
    Thanks
    David

    Hello,
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class CutNumberTest extends JFrame implements ActionListener {
         private JTextField input= new JTextField(10);
         private JTextArea result=new JTextArea(10,10);
         char[]numbers=new char[]{'0','1','2','3','4','5','6','7','8','9'};
         public CutNumberTest() {
              super("CutNumberTest");
              setDefaultCloseOperation(DISPOSE_ON_CLOSE);
              JButton cutButton = new JButton("cut number");
              cutButton.addActionListener(this);
              JPanel topPanel=new JPanel();
              JLabel label=new JLabel("Please enter price-code:");
              topPanel.add(label);
              topPanel.add(input);
              topPanel.add(cutButton);
              getContentPane().add(topPanel, BorderLayout.NORTH);
              getContentPane().add(new JScrollPane(result));
              pack();
              setLocationRelativeTo(null);
         public void actionPerformed(ActionEvent e) {
              char[] code=input.getText().toCharArray();          
              int counter=code.length;
              boolean lastNumFound=false;
              while(!lastNumFound && --counter >= 0)
                   lastNumFound=isNumber(code[counter]);
              result.append(lastNumFound ? "result: "+input.getText().substring(counter+1)+"\n" : "No number found!\n");
         private boolean isNumber(char chr){
              boolean isNumber=false;
              int counter=-1;
              while(++counter < numbers.length && !isNumber)
                   isNumber=numbers[counter]==chr;
              return isNumber;
         public static void main(String[] args) {
              new CutNumberTest().setVisible(true);
    }//copy/paste:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class CutNumberTest extends JFrame implements ActionListener {
         private JTextField input= new JTextField(10);
         private JTextArea result=new JTextArea(10,10);
         char[]numbers=new char[]{'0','1','2','3','4','5','6','7','8','9'};
         public CutNumberTest() {
              super("CutNumberTest");
              setDefaultCloseOperation(DISPOSE_ON_CLOSE);
              JButton cutButton = new JButton("cut number");
              cutButton.addActionListener(this);
              JPanel topPanel=new JPanel();
              JLabel label=new JLabel("Please enter price-code:");
              topPanel.add(label);
              topPanel.add(input);
              topPanel.add(cutButton);
              getContentPane().add(topPanel, BorderLayout.NORTH);
              getContentPane().add(new JScrollPane(result));
              pack();
              setLocationRelativeTo(null);
         public void actionPerformed(ActionEvent e) {
              char[] code=input.getText().toCharArray();          
              int counter=code.length;
              boolean lastNumFound=false;
              while(!lastNumFound && --counter >= 0)
                   lastNumFound=isNumber(code[counter]);
              result.append(lastNumFound ? "result: "+input.getText().substring(counter+1)+"\n" : "No number found!\n");
         private boolean isNumber(char chr){
              boolean isNumber=false;
              int counter=-1;
              while(++counter < numbers.length && !isNumber)
                   isNumber=numbers[counter]==chr;
              return isNumber;
         public static void main(String[] args) {
              new CutNumberTest().setVisible(true);
    Regards,
    Tim

  • How to search for a number located anywhere in string

    I am trying to search a string for a number (integer or float) without knowing its index in the string and to extract it - whether in numeric or string format.  e.g. "the number 52.63 appears in this string"; I want to extract/identify "52.63"
    The functions I come across seem to expect the index to be known or the number to be at index 0.  How can I achieve this?
    Best regards.
    Kenoss
    Solved!
    Go to Solution.

    If you are about to dive into the 'wonderfull world of Regular Expression' don't miss this (regular-expressions.info) site.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • Increment the number with date/time string. when ever the next date come's it should reset again with initial number

     i want to store the number of records in a file. Every time when ever i run the program the record will be incremented well i using forloop with count value 1 as a constant .in the for loop i am using autoincrement with the  feedback node . to view the number i have attached the indicatator .the number will be increment every time . i am using number to time time stamp  that is connected to get date/time string. from that we can view the date string and time string . so , my issue is when ever i close the code again it is coming with intial value . i should get from that number only where ever i close the code . after the date completed again it should come from intial value . i am attaching the code so that u guys can solve my problem.
    Attachments:
    record.doc ‏34 KB

    here you can see.......the file path in case structure in that i have included my requirement of increment the number 
    -> if the case is true then it goes in ok file path and the no of records string will pass in the file by seeing these code u will get the clarity
    my requirement is the number of records should increase ........ whnever the program runs...that i made it. by the next day again it should begain with the intial value.........that is my requirement. i hope u understand .
    suggest me how can i use the  intial  value .......
    Attachments:
    code.vi ‏35 KB

Maybe you are looking for

  • Embed fonts in PDF

    I want to publish a book on lulu.com which I created with MS Word for Mac. It must be in PDF format with embeded fonts. Firstly, how does one save a file as a PDF? Secondly, how does one embed fonts? Thanks!

  • Exporting different images to jpg (with different names)

    Dear Scripters, I KNOW I can script all this, but I need your help to find my way home- I have a doc made of 15 pages, each of these contains three or four instances of the same image, in different dimensions (iPhone, iPad, Android, Web, etc.). I pre

  • Oracle Secure Backup is not Appeared in EM

    Dear Sir, i have tried to show Oracle Secure Back in my EM as described in its Admin Guide a. Navigate to the ORACLE_HOME/hostname_SID/sysman/config directory and open the emoms.properties file in a text editor. b. Set osb_enabled=true and save the f

  • G4 won't start

    Silver front G4 won't start up. Recently replaced back up battery when this condition occured, start up fine. Computer was turned off for about 2 weeks while out of town, but now the on button lights momentarily, no boot uo. Won't even do that unless

  • I have never been able to download and install photoshop CC after 10 months, numerous attempts and a monthly payment.

      I continually get a large window that says, "Adobe Application Manager Quit Unexpectedly "  I have the option to reopen, but when I do the whole series starts over.