How to compare character with \ ?

Hi,
How can I compare a character with backslash ?
when I do 
if  (c == '\')
then it gives error invalid character constant
I cant even declare string with this value like
String str = "\";
this gives error string literal is not properly closed by double qoute
thanks in advance
B

Hi,
You can use the below
String str = "\\";
char c = '\\';
* are considered as \ at runtime.
Regards,
Sruti

Similar Messages

  • HOw to compare column with column using JCheckBox

    i have declare 4 JCheckBox which is a,b,c,d
    How to compare this value with the one in the database?

    Hi
    Say myCheckbox is the checkbox I want to test.
    The example below uses its state to query the database:
    String value;
    Statement stmt;
    ResultSet rset;
    value = myCheckbox.isSelected() ? "Y" : "N";
    stmt = conn.createStatement();
    rset = stmt.executeQuery("select column2 from table where column2 = "+value);
    In this case, the database colum is character, with the possibles values of Y or N.
    hth
    Luis Cabral

  • How to Compare date with Current system date in XSLT mapping.

    Hello Experts
    In a XSLT mapping program, I hava a filed, ZZOB which is giving some date.
    which I need to compare with the current date.
    Condition-
    ZZOB is greater than current date or ZZOBLIG = NULL
    Then go further statements.
    how can i campare with the current date?
    Please help.
    Thanks
    Balaprasad

    This example may help:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:param name="currentDate"/>
        <xsl:variable name="firstDate" select="concat(substring($currentDate, 1,4),substring($currentDate, 6,2),substring($currentDate, 9,2))"/>
        <xsl:template match="/">
            <xsl:apply-templates select="//item"/>
        </xsl:template>
        <xsl:template match="item">
            <xsl:variable name="secondDate" select="concat(substring(submissionDeadline, 1,4),substring(submissionDeadline, 6,2),substring(submissionDeadline, 9,2))"/>
            <xsl:choose>
            <xsl:when test="$firstDate &gt; $secondDate">
                <xsl:call-template name="late"/>
                </xsl:when>
                <xsl:when test="$firstDate &lt; $secondDate">
                    <xsl:call-template name="ontime"/>
                </xsl:when>
                <xsl:when test="$firstDate = $secondDate">
                    <xsl:call-template name="same"/>
                </xsl:when>
                <xsl:otherwise>Monkeys<br /></xsl:otherwise>
            </xsl:choose>
        </xsl:template>
        <xsl:template name="ontime">
            This is on time
        </xsl:template>
        <xsl:template name="late">
            This is late
        </xsl:template>
        <xsl:template name="same">
            This is on time
        </xsl:template>
    </xsl:stylesheet>

  • How to compare varchar with number

    i am doing one report for that am passing receipt number(from , to) as parameters
    if i compare for that table i am getting output.
    select receipt_num from rcv_shipment_headers rsh
    where to_number(rsh.receipt_num) between nvl(:P_RECEIPT_FROM,rsh.receipt_num) and nvl(:P_RECEIPT_TO,rsh.receipt_num)
    but when i am using in below query it is getting error "Invalid Number"
    select rsh.receipt_num
    , sum(rs.quantity)
    , rs.unit_of_measure
    , rct.transaction_date "Date of Entry"
    , pov.vendor_name
    , msi.segment1 "Item Code"
    , msi.description "Item Description"
    from rcv_transactions rct
    , rcv_shipment_headers rsh
    , rcv_shipment_lines rsl
    , po_vendors pov
    , mtl_system_items_b msi
    , rcv_supply rs
    where rsh.shipment_header_id=rct.shipment_header_id
    and rsh.shipment_header_id=rsl.shipment_header_id
    and rsl.shipment_line_id=rct.shipment_line_id
    and rsh.vendor_id=pov.vendor_id
    and rsl.item_id=msi.inventory_item_id
    and msi.organization_id=106
    and rsl.shipment_line_id=rct.shipment_line_id
    and rct.transaction_id=rs.rcv_transaction_id
    and to_number(rsh.receipt_num) between nvl(:P_RECEIPT_FROM,rsh.receipt_num) and nvl(:P_RECEIPT_TO,rsh.receipt_num)
    and rct.organization_id=nvl(:P_ORG_ID,rct.organization_id)
    and rsh.vendor_id=nvl(:P_Vendor_Name,rsh.vendor_id)
    and rct.inspection_status_code='NOT INSPECTED'
    group by rsh.receipt_num
    , rs.unit_of_measure
    , rct.transaction_date
    , pov.vendor_name
    , msi.segment1
    , msi.description
    plese help to solve
    Thanks & Regards
    Adina

    The problem lies here:
    and rsh.vendor_id=nvl(:P_Vendor_Name,rsh.vendor_id)How can you compare vendor_name with vendor_id????????????
    SQL> select * from po_vendors where vendor_id = NVL(&p_vendor_name,vendor_id);
    Enter value for p_vendor_name: 'AAAA'
    old   1: select * from po_vendors where vendor_id = NVL(&p_vendor_name,vendor_id)
    new   1: select * from po_vendors where vendor_id = NVL('AAAA',vendor_id)
    select * from po_vendors where vendor_id = NVL('AAAA',vendor_id)
    ERROR at line 1:
    ORA-01722: invalid number
    SQL> Message was edited by:
    user605919

  • How to compare date with thr current date

    Hi,
    I have an inout string which is in date format(dd/mm/yyyy hh:mm:ss) .
    what i need to do is comparing this date string with the current date. if my input string is less than current date , then display error message..
    how to do this?
    regards

    Excellent suggestions from all of you people!
    finally i got the solution
    code is:
    import java.util.*;
    import java.text.*;
    public class TestDate {
      public static void main(String args[]){
        TestDate a = new TestDate();
      TestDate() {
        String DATE_FORMAT = "dd/MM/yyyy hh:mm:ss";
         Date today = new Date();
         Date myDate=null;
        java.text.SimpleDateFormat sdf =
             new java.text.SimpleDateFormat(DATE_FORMAT);
         try{
         myDate = sdf.parse("01/06/2006 00:00:00");
         }catch(Exception e) {System.out.println(e);}
        Calendar c1 = Calendar.getInstance();
        Calendar c2 = Calendar.getInstance();
        c1.setTime(today);
        c2.setTime(myDate1);
        System.out.print(sdf.format(today));
        System.out.print(sdf.format(c1.getTime()));
        if (c1.before(c2)) {
           System.out.print(" is before ");
        if (c1.after(c2)) {
           System.out.print(" is after ");    
        if (c1.equals(c2)) {
           System.out.print(" same as ");    
    System.out.print(sdf.format(c2.getTime()));
      }

  • How to compare date with char

    hi
    i am having date from and date to feilds in my overtime element.i want to do the validation on these dates the the dates do not overlap or duplicated.the input value date from and date to are stored in database as varchar2 in the format yyyy/mm/dd 00:00:00. Now if i am trying to compare entered date with these dates i am getting literal does not match format string or date picture ends before....Can any body tell me what to do.
    Regards

    user10502390 wrote:
    hi
    i am having date from and date to feilds in my overtime element.i want to do the validation on these dates the the dates do not overlap or duplicated.the input value date from and date to are stored in database as varchar2 in the format yyyy/mm/dd 00:00:00. Now if i am trying to compare entered date with these dates i am getting literal does not match format string or date picture ends before....Can any body tell me what to do.
    RegardsPoint a) VERY BAD IDEA storing dates as VARCHAR2 on the database. It will only lead to corrupt data in the future.
    Point b) When comparing dates, you should compare them as DATE datatype as the database knows how to do comparisons against DATES. If you try and compare them as VARCHAR2 then you will most likely end up with incorrect comparisons.
    If you must have varchar2 storing of your dates/times (there's absolutely no reason to though)... you want...
    TO_DATE(:entered_date,'YYYY/MM/DD HH24:MI:SS') BETWEEN TO_DATE(DATEFROM,'YYYY/MM/DD HH24:MI:SS') AND TO_DATE(DATETO,'YYYY/MM/DD HH24:MI:SS')
    e.g.
    TO_DATE('20080815 13:23:33','YYYY/MM/DD HH24:MI:SS') BETWEEN TO_DATE(DATEFROM,'YYYY/MM/DD HH24:MI:SS') AND TO_DATE(DATETO,'YYYY/MM/DD HH24:MI:SS')

  • AWR snapshot not generatedand how to compare statistics with a baseline

    01. AWR snapshot not being generated even after setting looks fine
    02. compare a captured set of statistics with a baseline.
    i m not much clear on this, please help as i have this requirement at hand.
    Thanks a lot in advance.

    01.
    SQL> show parameter statis
    NAME TYPE VALUE
    statistics_level string TYPICAL
    I explicitly run and did cntl^C as it looks running endless... (waited almost 2-3 hours).
    SQL> exec dbms_workload_repository.create_snapshot;
    ^CBEGIN dbms_workload_repository.create_snapshot; END;
    ERROR at line 1:
    ORA-01013: user requested cancel of current operation
    looks like job_name is enabled.
    GATHER_STATS_JOB TRUE WEEKNIGHT_WINDOW
    freq=daily;byday=MON,TUE,WED,THU,FRI;byhour=22;byminute=0; bysecond=0
    GATHER_STATS_JOB TRUE WEEKEND_WINDOW
    freq=daily;byday=SAT;byhour=0;byminute=0;bysecond=0
    anything else can be checked, i dont have access to OEM..must be done at SQL prompt.
    02. thanks for info. i understand.. how do we compare set of snapshots with baseline(which is actually pair/range of snapshot kept for further comparison)
    no access to OEM. must be done at SQL prompt.
    please help in both. thanks ...

  • How to compare character/digits

    Hi,
    I have retrieved the last two character(it may be numbers or alphabets) of a string, using substr function. I want to compare the retrieved characters. Please help me how to do the same.
    Regards
    Uva

    Since both are varchar2 columns,
    SImply try beow..
    Let us think that u have two field -Filed1 and Filed2 - both are varchar2 type, then to compare, do below
    If Upper(Filed1) = Upper(Filed2) Then
    ----- Equal -Message
    Else
    --else Message
    End If

  • How to compare date with null value

    Hi
    I have a date filed and i assigned that input box with context attribute of type Date.
    Here my problem is
    when the end user not entered any thing (null ) the i have give some defaul date.
    so first in the action method i have to check the date with null
    if it is null i have to give default date.
    so please let me know how to over come this.
    thanks
    Mukesh

    Hi
    You can get your date in your action method like
    Date newDate=new Date();
    Date myDate= wdThis
                              .wdGetYourComponentNameController()
                                      .wdGetContext()
                                           .currentYourNodeNameElement()
                                                           .getYourDateName();
    if ( myDate== null) {
             wdContext.currentContextElement().setYourDateName(newDate);
    else{...........//continue your other validations or calling other methods}
    Regards
    Abhijith YS
    Message was edited by:
            Abhijith YS

  • How to compare files with Java - help me!

    Is there any free utilities?

    www.google.com and www.sourceforge.net would be good places to start. You can locate these using a 'browser'.
    - Saish

  • How to compare result from sql query with data writen in html input tag?

    how to compare result
    from sql query with data
    writen in html input tag?
    I need to compare
    user and password in html form
    with all user and password in database
    how to do this?
    or put the resulr from sql query
    in array
    please help me?

    Hi dejani
    first get the user name and password enter by the user
    using
    String sUsername=request.getParameter("name of the textfield");
    String sPassword=request.getParameter("name of the textfield");
    after executeQuery() statement
    int exist=0;
    while(rs.next())
    String sUserId= rs.getString("username");
    String sPass_wd= rs.getString("password");
    if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
    exist=1;
    if(exist==1)
    out.println("user exist");
    else
    out.println("not exist");

  • How to compare table's date field with dropdown year field

    Hi All,
    I have one requirement to display the selected rows from a database table based on the selection of drop down.
    Here, I have one dropdown of year(like 2009,2010,....) and I have one database table which contains one field with "DATE".
    Now, I want to compare table's DATE field with my dropdown field.
    Problem is that table's DATE field is of type "DATS" and dropdown is of type INTEGER(or) STRING ...
    How to compare this fields?
    Can any one please give me solution for this...!
    Thanks in Advance!

    Hi  sreelakshmi.B,
    try the following:
    DATA lt_dats        TYPE TABLE OF dats.
    DATA l_dat_i        TYPE          i.
    DATA l_dat_c_4(4)   TYPE          c.
    DATA l_dat_c_12(12) TYPE          c.
    DATA l_dats_from    TYPE          dats.
    DATA l_dats_to      TYPE          dats.
    *Move Date from Integer to Char
    l_dat_c_4 = l_dat_i = 2005.
    *Create Date From use in WHERE-Clause
    CONCATENATE '01.01.' l_dat_c_4 INTO l_dat_c_12.
    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
         EXPORTING
              date_external            = l_dat_c_12
         IMPORTING
              date_internal            = l_dats_from
         EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
    IF sy-subrc <> 0.
    ENDIF.
    *Create Date To use in WHERE-Clause
    CONCATENATE '31.12.' l_dat_c_4 INTO l_dat_c_12.
    CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
         EXPORTING
              date_external            = l_dat_c_12
         IMPORTING
              date_internal            = l_dats_to
         EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
    IF sy-subrc <> 0.
    ENDIF.
    * Select records in range
    SELECT *
           FROM [DBTAB]
           INTO TABLE [ITAB]
           WHERE [DATE] BETWEEN l_dats_from
                        AND     l_dats_to.
    Regards
    REA

  • How to compare a string with integer in jsp

    I have a field in database called as enddate
    i m trying to split the entire date and get date,month and year
    once i store the date in a variable called as fmdate which is string,
    i need to compare it with another integer.
    how can i compare it..heres my code
    stdate=RS.getString("start_date");
         fmdate=stdate.substring(8,10);
         fmmonth=stdate.substring(5,7);
         fmyear=stdate.substring(0,4);
    and this is where i want to compare the value of j to fmday...
    <td class="btext" valign="center">Day<select name="fmday">
    <%
    for(int j=1;j<=31;j++)
    String s;
    parseInt(s)=j;
    if (fmdate.equals(s))
    %>
    <option value="<%=j%>"><%=j%></option>
    <% } else { %>
    <option value="<%=j%>"><%=j%></option>
    <%
    } %>
    </select>
    pl help me...
    Thanks Srini

    j is an int, so you're just adding 0, not concatenating. Perhaps something like this would work.
    <%
      for(int j=1;j<=31;j++)
         String date = String.valueOf(j);
         if(j <= 9) {
            date = 0 + date;
         if (fmdate.equals(date)) {
    %>
      <option value="<%=date%>"><%=date%></option>
    <%
         } else {
    %>
      <option value="<%=date%>"><%=date%></option>
    <%
    %>Uhm, I assume there should be a 'selected' or something in one of the option tags?

  • How to compare Date in the TextField or DateTime with Date/Time field?

    Hi All,
    I am facing an issue with respect Date comparinson. I tried to look into entire discussions but failed to get the answer.
    My issue is: I wanted to comparet Date/time field value with Date value which is in TextField.
    The functionality of my form is:
    I have dropdown list which lists the registered customer ids binded to XML Datasource. On selection of the customer id from the dropdown I am displaying customer registration date in the TextField or say Date/Time field as below code in dropdown change event.
    RegistrationDetails.PurchaseEntry.txtRegDate.rawValue = regDataNode.CREATION_DATE.value; (this is TextField control)
    In form I have an Date/Time field in which use will select the date of item purchase. In the validation part I want to make sure that, the purchase date selected in Date/Time field must be greater than the Customer Registraiton Date. I able to compare if the customer selects the date from two different Date/Time fields. But how to compare the dates which one is in Date/Time field and Date is in TextField?
    I have tried using Num2Date and Date2Num with "YYYY-MM-DD"  format to compare but not succeed!
    Can you guys help me in this? Thanks in advance
    Regards.

    Hi,
    Yes, I am able to display the date which I have assigned to the text box. In the message box it show the value as '31/05/2009', since in this format i am assigining the date in the text box.
    Here is the code which I am assigning the value:
    RegistrationDetails.PurchaseEntry.txtRegDate.rawValue = regDataNode.CREATION_DATE.value;
    Do I need to change the format while assigning value in text box?
    You have told that, you have attached your test form, nothing is the reply. Can you repost the file?
    Regards.

  • How to replace the '&' character with '&' in xi

    Hi,
    i need to replace the '&' character with ' &amp;'.but i f i am converting it is displaying as '&' because internally '&amp;' = '&'.
    beacuse of this it is not converting.
    is there any possiblity to change the  standard conversion in xi.

    Graphical mapping does not support special character like & , <,> to be mapped.
    You can encode & as and in UTF-8 only.
    if you want the special character to be used, Opt XSLT mapping with ISO-8859-1 encoding
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="ISO-8859-1"/>
    <xsl:template match="/">
    <xsl:copy-of select="*" />
    </xsl:template>
    </xsl:stylesheet>
    How to Work with Character Encodings in Process Integration (NW7.0)
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42

Maybe you are looking for