Why do we need to put \\\\ for inserting a single \

Hi,
I wanted to replace the string h"i with h'i. The following code does that.
public class replace {
     public static void main(String a[]) {
          String hel = "h\"i";
          System.out.println(hel);
          hel = hel.replaceAll("\"","\\\\");
          System.out.println(hel);
My question is why do we need to put 4(\\\\) back slash for inserting a single \? Why not just put 2(\\) back slash? Your help is appreciated.
Sundar.

Hi,
Could you please explain bit more on this. Im talking about the second argument in replaceAll method.
All i want is to replace the double quote in the string h"i with h\i.
Why cant the code look like this hel = hel.replaceAll("\"","\\");
If i use this code i get the following exception.
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 1
at java.lang.String.charAt(Unknown Source)
at java.util.regex.Matcher.appendReplacement(Unknown Source)
at java.util.regex.Matcher.replaceAll(Unknown Source)
at java.lang.String.replaceAll(Unknown Source)
at hello.main(hello.java:70)

Similar Messages

  • Keynote and pages are now free, but why do i need to pay for them still when there now free?!?

    keynote and pages are now free, but why do i need to pay for them still when there now free?!?

    Users can obtain the iWorks and iLife applications free, if they purchased a Mac after the beginning of October 2013.
    Older Mac purchases require a paid purchase of these applications.

  • Why do i need payment informations for free games

    why do I need payment information for free games?

    You can create an iTunes account without payment info on file.
    Once you have a card on file, though, iTunes wants it to be current/valid. Don't think there's any way around it.

  • Syntax for inserting a single field

    hai
      can u please tell me what is the syntax for inserting a single field in ztable.
    Regards,
    N.selvamuthukumar.

    inserting a single field doesnt make sense if table has more dan one primary keys.
    The syntax is
    INSERT INTO TABLE  VALUES WA_TABLE.
    where wa_table is of type ztable.

  • Why do we need mention explicitly for Outbound plugs?

    Hello
    When i see a existing custom WD component's my_view's method code (action is APPROVE), i  see the below code
      wd_this->fire_tomain_plg( ).
    I also saw that MAIN view is the outbound plug for my_ view.
    1) Is this code is telling to the system that, it should navighate to MAIN view?
    2) if so, already we put this (TOMAIN) in OUTBOUND tab righ? why again having this piece of code EXPLICITLY in our method?
    3) is we (developers) need to put this manually? or or systme will put it at the bottom of the method automatically?
    4) but i did not see any such code for INBOUND PLUGs? why?
    Thank you

    ABAP_SAP_ABAP wrote:
    Hello
    >
    > When i see a existing custom WD component's my_view's method code (action is APPROVE), i  see the below code
    >
      wd_this->fire_tomain_plg( ).
    >
    > I also saw that MAIN view is the outbound plug for my_ view.
    >
    > 1) Is this code is telling to the system that, it should navighate to MAIN view?
    >  YES.
    > 2) if so, already we put this (TOMAIN) in OUTBOUND tab righ? why again having this piece of code EXPLICITLY in our method?
    >  In the outbound tab, you are specifying list of outbound plugs which can be used. however you need to fire the correct outbound plug via coding.
    > 3) is we (developers) need to put this manually? or or systme will put it at the bottom of the method automatically?
    >  You need to fire outbound plug for navigation. You can use WDA wizard to do that.
    > 4) but i did not see any such code for INBOUND PLUGs? why?
    >   We maintain navigation link b/w outbound and inbound plug at Window. This will automatically fire inbound plug corresponding to outbound plug.
    > Thank you

  • Why do you need to put credit card details in to the app store when you may want to simply obtain free items in the beginning?

    Apple clearly is a leader and thankfully are bringing fantastic products and initiatives to the market. 
    I certainly hope that the company doesn't get arrogant like it seems to do when forcing people trying to get free apps to put in credit card details. 
    I suspect it wouldn't be too much work to allow users to try it out first by using some free apps and when they are personally ready they can purchase to their little hearts desire.
    Poor showing from this perspecitive and easy to fix.

    Never put your credit card info into iTunes as Apple credit card security is horrible.  There are many cases of credit card problems with Apple. My credit card was compromised 2 weeks after creating an Apple account. That was the ONLY online usage of my credit card. 
    Apple does NOT follow PCI compliance which is the credit card industry standards for credit card data protection.  It requires all companies to NOT store credit card information online because (surprise, surprise Apple!) it can be hacked. 
    Why does Apple need to store the credit card data and put the information at risk and why do they not follow industry (PCI Compliance) guidelines - especially for free aps or updates?

  • Why do I need a hardwire for my WRVS4400N wireless router?

    I am not very technically inclined.  Plug and play is my way.  So when I got my first router (a linksys) i plugged in the ethernet cables and voila!-----internet access as well as connectivity for my xbox 360, ps3 and Wii.  The people rejoiced.
    Times change.  I was happy with my last Linksys hard-wired router, so when I finally got tired of all the wires laying around I went Linksys wireless.  BEST BUY told me the best wireless/hardwire router around is the WRVS4400N.  With this router I can have my 2 360's wireless as well as my pc.  The Wii and PS3 along with my wife's computer are hardwired.  There is also a hardwire going from the router to the Comcast cable modem.  Plug and play this, that and the other thing and voila!-----internet and gaming galore!  Once again, the people rejoiced.
    That is, until, I decided to make my wife's computer wireless.  The people rebelled.  Once my wife's pc went wireless (like my two 360's and pc),  I lost all connectivity.  No logging on to the playstation network, XBOX live, Wii surfing, and no internet access.  After many hours of turning off this, resetting that and plugging/unplugging the other thing, we finally figured out how to keep the people happy--one of the pc's has to be hard-wired to allow everything else to work (internet access, gaming, etc.).
    So the people are happy, but the king is not as his kingdom is bound by the tyranny of one ethernet cable.  Not to mention the fact that his wireless signal is unsecured.
    This makes no sense to me.  Why do I need one of the pc's to be hard-wired just to get everything else to work? 

    Trying to download firmware from this go_____ed company is like trying to pull teeth!  I mean, w_f?!  Are they trying to lose customers?
    I found answer ID 4030 and under step 2 it told me "to go to the Linksys download page, click here and verify the model and version number of your Linksys product."  I clicked on the link and that took me to "Support and Services."  I entered my model number where appropriate and that took me to some kind of small business section!  Small business?!?!?  I'm a bloody home user, not some f____ng businessman!!!!!
    Anyway, I click on this link:  Cisco Small Business (Linksys Business Series) software and firmware downloads (I know it says Small business, but where else was I supposed to go?  I mean, this is where Support and Services sent me).  That link took me to Support>Download Software.
    Under "Support>Download Software>Select a Software Product Category" I clicked on the Router Software link (which had a padlock icon next to it).  They wanted me to login again.  So I try, but I keep getting repeated (and erroneous) login errors telling me I entered my username and password incorrectly.  I checked my username and password many times.  No problems with my username or password.  Thus, a dead end there.
    I went to the "Support>Download Software>Software Search" and entered the model number of my router.  I clicked on this link:  Download Software for Cisco WRVS4400N Wireless-N Gigabit Security Router - VPN V1.0 & V1.1 : wrvs440....  Guess what?  They wanted me to login AGAIN!!!!!  So I try, but I get the same login error messages I got before!!!!!  Je___ _______ ____st!  Another dead end!
    I am at my wits end here.  Getting some kind of firmware for my router to work properly should not be this f____ng difficult!  I don't even know how to access my router's web user interface!
    Any other suggestions before I finally say goodbye to Linksys/CISCO?  Because I mean after this b______t experience, the next time I need some type of router or modem or something along those lines, I'm gonna think twice about going to Linksys/CISCO.
    P.S.  Sorry about my edited language, but if you had to go through what I did, I believe you'd be just as frustrated as I am.  I spent around $250.00 for this router and it doesn't even work right!!!!!
    Message Edited by JohnJr on 04-02-2009 10:07 PM
    Message Edited by JohnJr on 04-02-2009 10:08 PM

  • Why do we need material specification for transfering results to class char.

    Hi,
    Can you guys tell me why do we need to create material specification if we want to transfer quality inspection results to a batch class?
    Basically I have done the following:
    -Create Class Characteristic
    -Assign the Class Characteristic to a batch class
    -Link Class Char.  to MIC
    -Assign MIC to an Inspection Plan
    -Post GR, batch and inspection lot are created automatically
    -Record Results for inspection Lot
    -Make UD for Inspection Lot
    The result is not transferred to batch class, then I create material specification with the MIC assigned, the results can be transferred. But why?
    Best regards
    Danny

    Hello Danny,
    This is a standard program, which checks for this indicator at the time of inspection lot completion.
    F1- help gives satisfactory explanation
    Batch Valuation Possible Without Specification
    Use
    If you set this indicator, a link between the master inspection
    characteristics and the class characteristics for the batch class must exist
    when an inspection lot is created, for batch valuation to occur when the usage
    decision or inspection point valuation is made. A link within the material
    specification is not required.
    If you do not set this indicator, batch valuation only occurs when the
    usage decision or inspection point valuation is made, if a link using the
    material specification exists between the master inspection characteristics and
    the class characteristics for the batch class. In this way, you can control on a
    material-dependent basis whether the batch characteristics are valuated based on
    the inspection results.
    Amol.
    Message was edited by: Amol Manave : Main purpose is you can control whether Batch characteristics should be valuated based on results or not for particular material. If you set this indicator then batch characteristics will be valuated for all materials and in opposite case Batch characteristics will be valuated for only materials for which Material Specification exists.

  • Why Do We Need Java Webstart For XI

    Hi All,
    Can Any Body Please Explain me Why We Need Java Webstart For XI.
    What is the Use of it in XI.
    Please Let me Know
    Regards
    Babu

    Java web start is a technology by Sun Microsystems which enables running thick clients developed in Java after they are downloaded from the server and / or cached on the local drive...
    XI IR & ID are thick clients developed in Java which communicate with the XI server using EJB based communication and Java web start makes it possible to download / cache them and trigger point to run them...more on Java web start here -->
    http://java.sun.com/developer/technicalArticles/WebServices/JWS_2/JWS_White_Paper.pdf

  • Why dont we need process code for outbound master idoc?

    For inbound master idoc we need a process code (EX. matmas03-MATM) but for <b>outbound master idoc</b> why dont we need process code?can anybody clarify me on that.
    thanx in advance....

    plz clarify me on that...its urgent...

  • Why do I need to put spaces in here?

    I wrote a section of code like this:
    // increment the count each time countJButton is pressed
    private void countJButtonActionPerformed( ActionEvent event )
    countJTextField.setText ( String.valueOf(
    1 + Integer.parseInt(countJTextField.getText())));
    } // end method countJButtonActionPerformed
    I was able to compile and run with no errors but the code did nothing in the program. I then placed spaces in between the brackets like this:
    countJTextField.setText ( String.valueOf(
    1 + Integer.parseInt(countJTextField.getText() ) ) );
    and it runs. I thought Java is suppossed to ignore white space. So why does the first example not run and the second one run? What is the rule I need to know to do this correctly. (The books don't tell me and my instructor doesn't know).

    No nothing else was changed. I used javac to compile and got no errors. I then ran the program java Application. The application did nothing. I went back put in the spaces and resaved. javac to compile new and java Application to run and it works.
    Further I took the assignment to class. Class and teacher looked at it and could find 'nothing' different between there programs that ran and mine that didn't expect the spaces so I got the recommendation to try the spaces.
    The jdk I'm presently using came with the course book (Dietel's Simply Java Tutorial approch), which is j2sdk1.4.1_02. I have 1.5 on another Dietel book (How to program Java, 6th edition) I tried to compile a program from the 2nd book and recieved all kinds of errors. Sent a email to Dietel who advised me that the programs in the 2nd book were written to work with Java 5. I'm concerned about installing Java 5 and maybe not having it work on teh Simply Jaava Tutorials which make up the bulk of the course.
    All comments are appreciated.

  • Why do I need to wait for an engineering for an al...

    I'm moving home at very short notice due to a death in the family. I'm an existing BT customer moving to a rented home which 6 weeks ago had a working phone line. I work from home via IP and webex etc so having a working phone line and broad band are incredibly important.
    I've been given a date of the 7th of November for an engineer visit and have been told that a new phone line must be installed, with advice that they may not even need to access my property. This visit is costing me £130 or an extnesion to my contract.
    I don't understand why a new phone line must be installed, there is already a working phone line, I don't understand how a new phone line can be installed with no access to the property either?
    I am basically going to have to go and pay the local hotel for office space until this line is installed, so I am looking for an explanation of why it's going to cost me hundreds of pounds to have a line that was working very recently reactivated. It seems utter nonsense. If BT can cut someone off at the flick of a switch, why can't they turn it back on.
    I'm also concerned by the fact that they are not turning off my old line until the 7th, meaning that someone else could use the line in that time, they haven't even given me the option of plugging a phone in and giving it a go as they won't commence until the 7th, it all seems quite strange to me. Any explanations from BT would be welcome.
    The last time I moved home it took several months to get a working phone line, many threats of charges and eventually admitting it was their fault. I can't afford more time off work to get this sorted, and I'm very angry at having to sign a new contract after being a customer for years just to get an already working phone line reactivated!

    Welcome to this forum.
    This is a customer to customer forum only, where forum members, who are only BT customers, can help each other with BT Retail products and services.
    Anything you post here does not go to BT. Although the forum is moderated by BT, not all posts are read.
    The lines are provided by Openreach, for all service providers, so the existing line may have been used by a different service provider, and would need re-connecting within the exchange, to BT equipment.
    You could try plugging a phone in, and see if there is dialling tone. You can dial 1470 17070 to get the number, and dialling 150 should tell you who the service provider was.
    When you mention that you need this as you work from home, and its critical that it works, and repaired quickly if it goes wrong, then a BT Business line would would be the best option, as it will give you a much faster repair time, should anything go wrong.
    See http://business.bt.com/phone-services/bt-totalcare/
    The fact that you are having to rent office space, would tend to indicate that it is important to you.
    There are some useful help pages here, for BT Broadband customers only, on my personal website.
    BT Broadband customers - help with broadband, WiFi, networking, e-mail and phones.

  • Why do I need to pay for Network Extender?

    I've been exclusively a Verizon Wireless customer for over 11 years. Yearly I pay about $3,000 for my service, which I use for my business and personal use. Yet, I can't get a signal at my place of business, on the 10th floor in the middle of NYC! I get all bars in the basement of home an hour outside of the city! Plus, it's extremely embarassing when my clients complain that they can't connect and look at me for an answer why.
    I understand that this can be remedied using the Verizon Network Extender, but why should I have to pay an extra $250 just to get the service I'm already paying for ? Plus, this extender uses MY internet connection, My electrcity , AND others in the area can use it too for free ? Basically, I'm extending Verizons' network at my expense.
    You should supply this device at no charge to customers like myself who can't get service.

    Tonyfalcone, I can understand where you as well as Roy are coming from. Roy understanding a need for a workplace offered an alternative option for you, your clients and other businesses together can benefit from. The network extender we offer is much less. The network extender being an accessory isn't discounted like phones/devices but there's no contract, no monthly fees. You can set it to allow specific numbers priority access to the network extender. Alternately, speaking outside of vzw products, you can search online other signal boosters. Keep in mind, we don't have the support to help you if you needed to troubleshoot a third party product. 
    You mentioned you've been on our network for many years. Did you previously have service at your workplace? Can any Verizon user use their phone? If no to both, it does appear signal is being interfered or blocked. Personally, I've been on high floors in buildings and had service. Possibly they already installed a signal booster but I'm not sure. 
    Thank you

  • Why Do we need to go for Alias? What are the Different uses of Aliases?

    Hello Everybody?
    I wanted to know the uses of aliases in RPD level. I do know some points like they will be used as a duplicate copy for the base tables and they will be used to remove the circular joins, otherthan this can anybody please give me a brief view about the different uses of Aliases.

    This article gives some good arguments for why you should use aliases:
    http://it.toolbox.com/blogs/achieving-great-bi/physical-layer-tips-and-gotchas-16445
    1. Import physical tables without FK joins turned on. Make the joins yourself, so there is nothing hidden that could cause problem. You should "own" your joins, not the other way around.
    2. Aliases are the technique one uses to eliminate circular joins. An easy example of how to use aliases is when you have a lookup table, like W_LOV_D - each version of it requires an alias, which will be joined to differently.
    3. With all tables & aliases, using a naming standard will guarantee that only one physical layer object will exist in one Business Model object. If you prefix every object in the physical layer with its Logical usage first (essentially making everything an alias), you will not be able to use the Customer (W_COUNTRY_D) table in the Employee logical table, as the standard would require you to use a table alias called Employee (W_COUNTRY_D).

  • What is maintenance View . Why do we need to go for maintenance View

    Hi,
    I wanted to create maintenance view. Before that i wanted to know what is maintenance veiw and why do we go for maintenance view

    SE11, enter the table name click change. In the next screen, click Utitlies-->table maintenance generator.
    Enter &NC& as the auth group.
    Enter the function group to use  (ex. Z_TABMAINT)
    click One Step, enter '1' as the screen number. Click the create button.
    Once generated, you can use it by going to SM30, enter table name and click maintain

Maybe you are looking for

  • I have a Desk Jet 3050. How can I get it back online?

    The product is HP Desk Jet 3050 , I operate on Windows 7. Printer is saying not connected to wireless. My local cable company had internet issues and the printer worked fine before. Everything BUT the wireless printer worked normal after the issue wa

  • Double payment for a song ?

    hi guys - does the itunes store recognize when you try to buy a song you have already bought from the store in the past ?

  • Vendor Number gets disappear

    Hi Gurus Have an issue- When I am creating purchase order on a specific vendor, vendor number gets disappear from the ME21N screen I verified vendor master is neither blocked nor marked for deletion Any guess , what could be the reason? Thanks in adv

  • Bug in Graph Legend Height Property

    Hi All, I am trying to set the height of the graph legend via property node and it seems it is not setting it to the input value. I set the value of the height and read it back and they do not match. Is it a bug in the property node? I have attached

  • Minimum Hardware Requirement for Siebel CRM 8.0 for Linux Platform?

    Hi, What are the minimum hardware requirement for Siebel CRM 8.0 for Linux OS?