Comparing char to a value

How do you compare a value of a character to another value...I don't really know how to explain here is my code
      int x=1;
      int[] answer;
      String newString="";
      String result=enter.getText();
      int size=result.length();
      char theCharacter;
      for(x=1; x<=size; x++)
        theCharacter = result.charAt(x);
        while(theCharacter != " " && x <= size)
          newString=newString+result.charAt(x);
        answer[x]=Integer.parseInt(newString);
        enter.setText("");
      }I am trying to take input from a textbox and read the input until I get to a space basically.

You could try.
String newString = "";
int iSpace = result.indexOf(" ");
if (iSpace >=0)
newString = result.substring(0,iSpace);
else
newString = result;

Similar Messages

  • Compare two text box values????

    Hello All,
    I do have one logic, but not sure where to write it so want your guys help for the same.
    The logic is:-
    if (&P13_NEW_PASSWORD. == &P13_CONFIRM_NEW_PASSWORD.) then
    insert into tbuser (password) values (&P13_NEW_PASSWORD.);
    else
    dbms_output.line_('Both the text boxes should be same!!')
    P13_NEW_PASSWORD and P13_CONFIRM_NEW_PASSWORD are two text boxes, where in above statment I'm comparing two text box values, if yes than insert that values into the DB tables otherwise displaying else messges.
    so can anybody tell me where should i write the above logic to make it work perfect..!!!
    thanks
    regards,
    Kumar

    Kumar,
    I'm glad you asked! Here's a great blog post on a custom auth scheme that hashes passwords:
    http://djmein.blogspot.com/2007/07/custom-authentication-authorisation.html
    I would suggest a few changes to the "get_hash" function. First, the DBMS_OBFUSCATION_TOOLKIT has been deprecated in favor of DBMS_CRYPTO:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_crypto.htm
    http://www.psoug.org/reference/dbms_crypto.html
    DBMS_CRYPTO offers Message Authentication Code (MAC) functions which are keyed hashes. If you use a non-keyed function such as MD5 (which is VERY well known), someone can easily generate a table of all possible passwords within reason and their matching hash, which essentially allows them to get the passwords. MAC functions take in the data (password in this case) and a key. You can probably just use a big random string for your key. Now someone would need to the key as well to generate a hash table. In short, just use DBMS_CRYPTO.MAC where Duncan used DBMS_OBFUSCATION_TOOLKIT.md5.
    Tyler

  • Compare previous with Current Value

    Want to compare previous with current value and assign the right one..
    COLA COLB
    72 21356
    41023 21356
    90 78903
    90 89078
    90 78956
    90 45632
    41023 78903
    41023 45632
    Output I want is:
    COLA COLB
    72 21356
    72 21356
    90 78903
    90 89078
    90 78956
    90 45632
    90 78903
    90 45632
    Anytime the value in COLA is 41023, I need to look at value in COLB and compare it with the rest of values and assign the COLA value that is NOT 41023
    Thanks...

    Not sure but here a try :
    SQL> select * from tbltbl;
          COLA       COLB
            72      21356
         41023      21356
            90      78903
            90      89078
            90      78956
            90      45632
         41023      78903
         41023      45632
    8 rows selected.
    SQL> MERGE INTO tbltbl a
      2  USING (select c.cola,b.rowid rwd
      3         from   tbltbl b,
      4                tbltbl c
      5         where  b.cola=41023
      6         and    b.colb=c.colb
      7         and    c.cola!=41023) d
      8  on    (a.rowid=d.rwd)
      9  WHEN MATCHED THEN UPDATE set a.cola=d.cola;
    3 rows merged.
    SQL>
    SQL> select * from tbltbl;
          COLA       COLB
            72      21356
            72      21356
            90      78903
            90      89078
            90      78956
            90      45632
            90      78903
            90      45632
    8 rows selected.Works only if colb is unique for non 41023 value.
    Nicolas.
    Oh, very very late.
    Edited by: N. Gasparotto on Oct 3, 2008 5:05 PM

  • How to call VC++ dll whiich return char[] data type value in powerbuilder

    Hi Everyone,
    I am using PowerBuilder 11.1 build 8123.
    I am calling VC++ DLL in our PowerBuilder application which return char[] data type value.
    I just declare Global External Function:-
         Function  char getOSSectionName() library "DocServClient.dll" alias for "getOSSectionName;Ansi"
    And then call this function in window as:-
         Char      ls_section[1] = 'DOCAPPLICATIONS9X'
         ls_section[1]=getOSSectionName()
    When I check ls_section[1] value in messagebox it display a symbol (please check attached attached image.)
    VC++ function and return variable declaration:-
         __declspec(dllexport) char *  __stdcall getOSSectionName()
           char    SectionName[_MAX_PATH];
    Please let me know that my code is valid or not.
    Please help..

    Hi,
    Thanks to Everyone for your suggestions.
    I am solved my problem to change VC++ function as :-
         Int __declspec(dllexport)  __stdcall getOSSectionName(char* SectionName)
                        instead of
         __declspec(dllexport) char *  __stdcall getOSSectionName()
    and declare global function as:-
           Function int getOSSectionName(Ref char ls_section[100]) library "DocServClient.dll" alias for "getOSSectionName;Ansi"
    and call function in window as:-
         int li_ret
         char ls_section[100]
         string ls_sec
         li_ret=getOSSectionName(REF ls_section)
         ls_sec=ls_section
    Thanks,
    Vikrant

  • How do I compare chars?

    Hi!
    I've got a problem comparing chars. Is there a way to check that a char is "earlier" than another one?
    By "earlier" i mean that for example A is earlier than B, B is earlier than C etc.
    Thanks in advance!

    DrClap wrote:
    BigDaddyLoveHandles wrote:
    The javadoc for compareToIgnoreCase states:
    This method returns an integer whose sign is that of calling compareTo with normalized versions of the strings where case differences have been eliminated by calling Character.toLowerCase(Character.toUpperCase(character)) on each character. Why use both toUpperCase and toLowerCase?Probably something to do with either the Turkish i's problem or the &szlig; character.I see now. For example: upper case versus lower case versus title case -- it's not either/or.
    [http://java.sun.com/javase/6/docs/api/java/lang/Character.html#isTitleCase(int)]

  • How to compare char and numc in select query

    Hi  Experts,
    I am using For all entries  to combine two tables.
    I want to fetch the data from these tables.
    The field in one table char, and in another the field is numc.
    1st Query from table BDCP2  and get the tabkey value is like (2000000000000000000086200000000000000000000)
    2nd query     For all entries found,
    query table ESTMJ with the following parameter.
         ESTMJ-RECN = BDCP2-TABKEY+3(20)
    1.TABKEY         CHAR     254
    2.RECN         NUMC     20     
    How to compare these two ?
    Regards,
    Bindhu Priya.

    for  two fields numc & char , please check out their Conversion routine in their respective Database table.
    1st in SE11-> enter table names in different sessions. and check out the data domain used by this fields
    In their respective domains of fields, click on tab 'DEFINITIONS', then check out the conversion routines in Output Characteristics of the Data Domain of field
    From my point of view, both the Conversion routines should be the same.
    If Conversion Routines are not there, then insert suitable Conversion routine for both the fields domain
    For help for for conversion routines:
    conversion routine
    http://help.sap.com/saphelp_46c/helpdata/en/cf/21ee19446011d189700000e8322d00/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/35/26b217afab52b9e10000009b38f974/content.htm
    http://abaplovers.blogspot.com/2008/03/conversion-routines-in-sap.html
    hope this solution could solve your issue..
    <begging removed by moderator>
    Gaur Mayank
    Edited by: Gaur Mayank on Nov 5, 2011 10:40 AM
    Edited by: Thomas Zloch on Nov 6, 2011 3:59 PM

  • Transfer a char type varialble value to NUMC type variable

    Hi all,
    I have a BSEG-PROJK  type NUMC(8) variable and one xyz type CHAR(50)  variable.
    I have to pass value from xyz to BSEG-PROJK
    my e.g is that while I am passing
    xyz= 'M-000064'
    BSEG-PROJK  = xyz
    then the value of BSEG-PROJK is 00000064 but i need M-000064

    Hi,
    The value M-000064 is showing in field PROJK of BSEG, due to the conversion routine ABPSP attached in the domain level of this field.
    - To check the actual value stored in data base level
    - SE16 Give table name=>to see the table contents Press F7=>settings=>user parameters=> uncheck the check box check conversion exit.
    - now the value in field PROJK will show in numeric.
    Regards
    DKS

  • Need to compare html text area values by using java script

    I have one html text area in my JSP file. when i click on that text area, a pop-up will come, in that pop-up i have list of items. So after selecting a item from that pop-up list, need to click okay. so that text area will update with the selected value.
    In this case, i need to compare the first text area value and updated text area value. How can i do that in Java Script.

    I suggest you look for a Javascript forum to ask questions about Javascript. This is a Java forum.

  • Compare E1EDP26 QUALF BETRG values

    Hello All,
    Was hoping you could help me wit the following issue I'm facing in an IDoc to File scenario. I'm tasked with a 'create if' statement comparing the values of BETRG in E1EDP26 with different QUALF values.
    For example: create target segment if E1EDP26 QUALF 003 is not equal to E1EDP26 QUALF of 010. Can this be accomplished in graphical mapping or will I need to create a UDF?
    Thanks in advance!

    As both are under the same segment and i assume the qualf occures only once.
    May be you can try something like below.. raise the context of the QUALF and the field which you are comparing to E1EDP26 level

  • Comparing char in a string to strings in a txt file

    Hi guys, i am dveloping a scrabble application for a project in jvava. Currently, i am trying to work on coding a computer player to play against a human, ive finished all the game logic nd 2 human players can successfully play on the same system.
    My problem is when coming up with the AI logic, i am faced with the problem of how to compare the computer player's letters to the dictionary txt file in order to find the possible words he can play.
    For example, the PC player has the letters A,B,E,G,T,F in his rack, it searches the dictionary and finds words that also contain these characters, so it would return words like AT, BAT, GATE, etc. I have already looke up the Jumble algorithm, but i dont really understand it(im still quite new to java).
    I already have a ditionary class which i put the code below.
    What i want to do now is just to come up with a simple method that takes a string, and compares the chars, and find words that match the char and return them but i dont knw hw to come about it.
    import java.util.Scanner;      
    import java.io.IOException;  
    import java.util.ArrayList;   
    import java.io.*;             
    public class Dictionary
        ArrayList<String> dictionary;
        public Dictionary() throws IOException
            dictionary = new ArrayList<String>();
        public void readInDictionaryWords() throws IOException
            File dictionaryFile = new File("c:/data/dict.txt");    // declare the file
            if( ! dictionaryFile.exists()) {
                System.out.println("*** Error *** \n" +
                                   "Your dictionary file has the wrong name or is " +
                                   "in the wrong directory.  \n" +
                                   "Aborting program...\n\n");
                System.exit( -1);    // Terminate the program
            Scanner inputFile = new Scanner( dictionaryFile);
            while( inputFile.hasNext()) {
                dictionary.add( inputFile.nextLine().toUpperCase() );
        public boolean wordExists( String wordToLookup)
            if( dictionary.contains( wordToLookup)) {
                return true;    // words was found in dictionary
            else {
                return false;   // word was not found in dictionary
        return"";
    }

    Loops...
    You take the first
    then second
    then third
    and etc
    You take the first 2
    the next 2
    the next 2
    etc
    all the way through n characters
    once you have gone through this, then you have to do all possible combinations of characters of 2 through n.
    Here is an implementation of N choose k for k up to 7:
    public class Junk {
      public Junk(){
      public void choose1(String s){
        int lCount=0;
        for(int i=0; i<s.length(); i++){
          System.out.println("("+s.charAt(i)+")");
          lCount++;
        System.out.println("Distinct Combinations: "+lCount);
      public void choose2(String s){
        int lCount=0;
        for(int i=0; i<s.length(); i++){
          for(int j=i+1; j<s.length(); j++){
              System.out.println("("+s.charAt(i)+", "+s.charAt(j)+")");
              lCount++;
        System.out.println("Distinct Combinations: "+lCount);
      public void choose3(String s){
        int lCount=0;
        for(int i=0; i<s.length(); i++){
          for(int j=i+1; j<s.length(); j++){
            for(int k=j+1; k<s.length(); k++){
              System.out.println("("+s.charAt(i)+", "+s.charAt(j)+", "+s.charAt(k)+")");
              lCount++;
        System.out.println("Distinct Combinations: "+lCount);
      public void choose4(String s){
        int lCount=0;
        for(int i=0; i<s.length(); i++){
          for(int j=i+1; j<s.length(); j++){
            for(int k=j+1; k<s.length(); k++){
              for(int l=k+1; l<s.length(); l++){
                System.out.println("("+s.charAt(i)+", "+s.charAt(j)+", "+s.charAt(k)+", "+s.charAt(l)+")");
                lCount++;
        System.out.println("Distinct Combinations: "+lCount);
      public void choose5(String s){
        int lCount=0;
        for(int i=0; i<s.length(); i++){
          for(int j=i+1; j<s.length(); j++){
            for(int k=j+1; k<s.length(); k++){
              for(int l=k+1; l<s.length(); l++){
                for(int m=l+1; m<s.length(); m++){
                  System.out.println("("+s.charAt(i)+", "+s.charAt(j)+", "+s.charAt(k)+", "+s.charAt(l)+", "+s.charAt(m)+")");
                  lCount++;
        System.out.println("Distinct Combinations: "+lCount);
      public void choose6(String s){
        int lCount=0;
        for(int i=0; i<s.length(); i++){
          for(int j=i+1; j<s.length(); j++){
            for(int k=j+1; k<s.length(); k++){
              for(int l=k+1; l<s.length(); l++){
                for(int m=l+1; m<s.length(); m++){
                  for(int n=m+1;n<s.length(); n++){
                    System.out.println("("+s.charAt(i)+", "+s.charAt(j)+", "+s.charAt(k)+", "+s.charAt(l)+", "+s.charAt(m)+", "+s.charAt(n)+")");
                    lCount++;
        System.out.println("Distinct Combinations: "+lCount);
      public void choose7(String s){
        int lCount=0;
        for(int i=0; i<s.length(); i++){
          for(int j=i+1; j<s.length(); j++){
            for(int k=j+1; k<s.length(); k++){
              for(int l=k+1; l<s.length(); l++){
                for(int m=l+1; m<s.length(); m++){
                  for(int n=m+1; n<s.length(); n++){
                    for(int o=n+1; o<s.length(); o++){
                      System.out.println("("+s.charAt(i)+", "+s.charAt(j)+", "+s.charAt(k)+", "+s.charAt(l)+", "+s.charAt(m)+", "+s.charAt(n)+", "+s.charAt(o)+")");
                      lCount++;
        System.out.println("Distinct Combinations: "+lCount);
      public static void main(String[] args) {
        Junk j = new Junk();
        j.choose7("1234567");
    }I'll leave it to you to integerate the algos into your app appropriately.

  • Update table based on ID reference comparing each column and value

    Hi,
    Through UI user can update any information and click save. In backend i will be receiving only ID as reference . Based on the ID value i should update multiple tables wherever i have the reference tables. Here i will not get the values or column name updated.
    I just get a ID to find which row is updated.
    I should do a comparision now. 
    I have a history table where i get the row before updation. and i get a row after updation from current data i.e. from ssdb_Railroad[This will be updated by java after updation we will get the ID inorder to update remaining tables]. Now i need to compare
    both the table column values and know which column is updated and after getting the value i should update reference tables.
    Below is the structure for comparision table , History table and Main table.
    Create table Comparision_History (
     ID   int IDENTITY(1,1) PRIMARY KEY,
     InsertUser_UpdateUser varchar(50),
     Old_ColVal  varchar(100),
     New_ColVal  varchar(100),
     TableName   varchar(100),
     [Action]     varchar(50),
     InsertDate_UpdateDate Datetime NOT NULL DEFAULT getdate()
    CREATE TABLE SSDB_Railroad_History (
        ID         int IDENTITY PRIMARY KEY,
    SCAC       varchar(4) ,
    Name       varchar(50) NOT NULL,
    RailroadID int NOT NULL UNIQUE,
    RC2Key
      varchar(50),
    NOTES      varchar(1000),
    [Action]   varchar(50),
    InsertDate_UpdateDate  Datetime NOT NULL DEFAULT getdate(),
    InsertUser_UpdateUser  varchar(50),
    CREATE TABLE SSDB_Railroad (
        ID   int IDENTITY(1,1)PRIMARY KEY,
    SCAC varchar(4) UNIQUE,
    Name varchar(50) NOT NULL,
    RailroadID int NOT NULL UNIQUE,
    RC2Key
    varchar(50),
    InsertDate Datetime NOT NULL DEFAULT getdate(),
    UpdateDate Datetime,
    InsertUser varchar(50),
    UpdateUser varchar(50)
    Here SSDB_Railroad table and History table needs to be compared and get a updated value and it should be inserted in a comparision table. as well as it should be updated in reference tables.
    Please help me with the code.
    Thanks in Advance
    Deepa

    Hi Deepa_Deepu,
    According to your description, personally, the merge function can meet your requirements. Usually, we can synchronize two tables by updating or inserting rows in a target table based on differences found in the source tables. Just as your description, when
    the value of ID and InsertDate_UpdateDate in the source table matches a value, update them in the target table. When the values does not match, the source row is inserted into the target table.
    For more information, see: using MERGE to perform UPDATE and INSERT operations on a target table by using a derived source table.
    http://msdn.microsoft.com/zh-cn/library/bb510625.aspx
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • SWFVISU doesn't accept longer iView ids than 255 char as parameter value?

    Hi,
    I'm using the UWL to display SAP Business Workflow work items in the portal.
    Everything works fine.
    I made also a simple Business Workflow which starts a standard sap transaction after executing the task.
    The transaction is displayed in the portal as SAP GUI for HTML.
    But now, instead of executing the transaction, I want to execute an iView from a Business Package.
    So I used the transaction SWFVISU to change the visualization type for the task (e.g. TS99000004).
    The iView of the Business package is a WebDynpro for ABAP application.
    So I could choose "iView" or "ABAP Web Dynpro" as visualization type.
    My questions:
    If I use "iView", than I could not enter the whole value of the iView location into the parameter for "ID", because the pcd location of the iView is longer than 255 char (beginning with "pcd:portal_content/(...))"!
    Is there a way to enter this in SWFVISU or is this only possible using an own XML configuration file in the uwl portal for this task?
    Thanks,
    Andreas

    Hi Andreas,
    I think the recommended and very common way is not to tweak the pcd location with delta copies or others but just to use the XML config (if SWFVISU doesn't cover your needs). In later EP versions there is also wizard functionality included so you don't need to actually code any XML but just use the wizard.
    Regarding the possibility of having multiple XML files declaring the same item type/task, no problems there.
    When registering the task types in UWL administration, an xml file with low priority is generated including e.g. declaration of item type A. Now when you upload your own xml file including declaration of item type A as well, the system should automatically assign the file medium (or high) priority. You can also manually change the priorities.
    So the problem is eliminated using priorities. Your custom xml config overrides the swfvisu-originated item types since it's of higher priority. This means in other words the lower priority swfvisu items are not taken into account.
    Hope this helps,
    Mikko

  • How to covert exponent figure in char to numerical value

    Hi all,
    I am getting value 3.0000000000000000E+01 in one of char field in the output of my report , But I want it to be display as '30' . Please help , and tell how to convert the value
    Thanks and regards,
    V.Kumar

    Hello,
    - You will find below the code that will answer to your question :
    REPORT ztest.
    DATA : wv_count TYPE sy-dbcnt.
    DATA : wv_fltp  TYPE imrg-readg.
    DATA : wv_char  TYPE char22 VALUE '3.000000000000E+01'.
    MOVE   wv_char  TO wv_fltp.
    WRITE  wv_fltp  TO wv_char EXPONENT 0 DECIMALS 0.
    WRITE / wv_char.
    Cordialement,
    Chaouki.

  • Converting char to decimal value format as defined in SU3(User profile)

    Hi Techies,
    Is there any FM to convert CHAR value into Decimal fomat as defined in SU3.
    If we use, WRITE statement for printing the value in decimal format , it shows the value in decimal format correctly
    in SU3 transaction , there are three different decimal format notations which can be user specific
    I would appreciate your valuable inputs ....
    Thanks
    Santhosh

    This is my code in a generic method to transform a table into a csvrow
    when 'P'.
            tmpstr = <p_field>.
            len = strlen( tmpstr ) - 1.
            tmpstr = tmpstr+0(len).
            if <p_field> < 0.
              sign = '-'.
            else.
              sign = ' '.
            endif.
            case decimalformat.
              when 'X' or 'E'.
                split tmpstr at '.' into int frac.
                ptmp = int.
                write ptmp to cp.
                shift cp left deleting leading space.
                replace all occurrences of '.' in cp with ','.
                concatenate
                  s
                  sign
                  cp
                  frac
                  delimiter
                into s in character mode.
              when 'Y' or 'D'.
                split tmpstr at '.' into int frac.
                ptmp = int.
                write ptmp to cp.
                shift cp left deleting leading space.
                replace all occurrences of ',' in cp with '.'.
                concatenate
                  s
                  sign
                  cp
                  frac
                  delimiter
                into s in character mode.
              when ' '.
                concatenate s sign tmpstr delimiter into s in character mode.
              when others.
                concatenate s '????????' delimiter into s in character mode.
            endcase.
    where pfield is a fieldsymbol type P. (honestly ist from type any, but determined by RTTI). I needed this cause i want to format the value from "outside" without taking the user settings in consideration as write...to.. is doing.
    What i'm doing is to use the write... to... clause modifying the result (change decimal point, thousand separator and sign) according to the demanded decimal notation.
    Edited by: Rainer Hübenthal on Oct 7, 2009 4:47 PM

  • How to create insp. char as ( or ) value

    Dear
    Gurus
    Can anybody help me to create Inspection char like ( <5) or (>5)
    i am able to create the insp char with limits like (2-10) but i am not getting how to create with only values with > or < .
    Thanks and regards
    madhu

    RESOLVED
    Thanks and regrds
    Madhu

Maybe you are looking for