How to replace in a String

I really want to know how to replace " in a String with replaceAll()
I want to replace " with \"
Unortunately I am not able to do it with :
xml = xml.replaceAll("\"", "\\\"");Can u please suggest something
thanks

public class Test {
public static void main(String[] args) {
   System.out.println("abc>def".replaceAll(">","\"+"));
}Output:
abc"+def

Similar Messages

  • How to replace mixed chars string

    Hi All,
    I want to replace mixed chars string from each row and want to replace with new string.
    Ex : The existing string might be in different cases like "Abc string", "abc string", "aBC string". I want to search for all these string types and want to replace with new string "Abc string".
    Could anyone give suggestions on this.
    Thanks,
    Prakash

    [url http://download.oracle.com/docs/cd/E11882_01/server.112/e26088/functions149.htm#i1305521]REGEXP_REPLACE supports case insensitive replacing.
    REGEXP_REPLACE(source_string,'abc string','Abc string',1,0,'i')The *'i'* specifies case insensitive replacing, so it will find all of "Abc string", "abc string", "aBC string" :-)

  • How to replace double quotes with a single quote in a string ?

    Hi All:
    Can some one tell me how to replace double Quote (") in a string with a single quote (') ? I tried to use REPLACE function, but I couldn;t get it worked.
    My example is SELECT REPLACE('STN. "A"', '"', ''') FROM Dual --This one throws an error
    Thanks,
    Dima.

    Whether it is maybe not the more comfortable way, I like the quoting capabitlity from 10g :
    SQL> SELECT REPLACE('STN. "A"', '"', q'(')') FROM Dual;
    REPLACE(
    STN. 'A'{code}
    Nicoals.                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to replace multiple occurences of space in a string to a single space?

    How to replace multiple occurences of space in a string to a single space?

    Hi,
    try this code.
    data : string1(50) type c,
              flag(1) type c,
              dummy(50) type c,
              i type i,
              len type i.
    string1 = 'HI  READ    THIS'.
    len = strlen( string1 ).
    do len times.
    if string1+i(1) = ' '.
    flag = 'X'.
    else.
    if flag = 'X'.
    concatenate dummy string1+i(1) into dummy separated by space.
    clear flag.
    else.
    concatenate dummy string1+i(1) into dummy.
    endif.
    endif.
    i = i + 1.
    enddo.
    write : / string1.
    write : / dummy.

  • How Can I replace newScale Text Strings with Custom Values?

    How Can I replace newScale Text Strings with Custom Values?
    How can I replace newScale text strings with custom values?
    All  newScale text is customizable. Follow the procedure below to change the  value of any text string that appears in RequestCenter online pages.
    Procedure
    1. Find out the String ID of the text string you would like to overwrite by turning on the String ID display:
    a) Navigate to the RequestCenter.ear/config directory.
    b) Open the newscale.properties file and add the following name-value pair at the end of the file:res.format=2
    c) Save the file.
    d) Repeat steps b and c for the RmiConfig.prop and RequestCenter.prop files.
    e) Stop and restart the RequestCenter service.
    f) Log  in to RequestCenter and browse to the page that has the text you want  to overwrite. In front of the text you will now see the String ID.
    g) Note down the String ID's you want to change.
    2. Navigate to the directory: /RequestCenter.ear/RequestCenter.war/WEB-INF/classes/com/newscale/bfw.
    3. Create the following sub-directory: res/resources
    4. Create the following empty text files in the directory you just created:
    RequestCenter_0.properties
    RequestCenter_1.properties
    RequestCenter_2.properties
    RequestCenter_3.properties
    RequestCenter_4.properties
    RequestCenter_5.properties
    RequestCenter_6.properties
    RequestCenter_7.properties
    5. Add the custom text strings to the appropriate  RequestCenter_<Number>.properties file in the following manner  (name-value pair) StringID=YourCustomTextString
    Example: The StringID for "Available Work" in ServiceManager is 699.
    If you wanted to change "Available Work" to "General Inbox", you  would add the following line to the RequestCenter_0.properties file
         699=General Inbox
    Strings are divided into the following files, based on their numeric ID:
    Strings are divided into the following files, based on their numeric ID:
    String ID  File Name
    0 to 999 -> RequestCenter_0.properties
    1000 to 1999 -> RequestCenter_1.properties
    2000 to 2999 -> RequestCenter_2.properties
    3000 to 3999 -> RequestCenter_3.properties
    4000 to 4999 -> RequestCenter_4.properties
    5000 to 5999 -> RequestCenter_5.properties
    6000 to 6999 -> RequestCenter_6.properties
    7000 to 7999 -> RequestCenter_7.properties
    6. Turn off the String ID display by removing (or commenting out) the line "res.format=2" from the newscale.properties, RequestCenter.prop and RmiConfig.prop files
    7. Restart RequestCenter.
    Your customized text should be displayed.

    I've recently come across this information and it was very helpful in changing some of the inline text.
    However, one place that seemed out of reach with this method was the three main buttons on an "Order" page.  Specifically the "Add & Review Order" button was confusing some of our users.
    Through the use of JavaScript we were able to modify the label of this button.  We placed JS in the footer.html file that changes the value of the butt

  • How to replace a character in a string with blank space.

    Hi,
    How to replace a character in a string with blank space.
    Note:
    I have to change string  CL_DS_1===========CM01 to CL_DS_1               CM01.
    i.e) I have to replace '=' with ' '.
    I have already tried with <b>REPLACE ALL OCCURRENCES OF '=' IN temp_fill_string WITH ' '</b>
    Its not working.

    Hi,
    Try with this..
    call method textedit- >replace_all
      exporting
        case_sensitive_mode = case_sensitive_mode
        replace_string = replace_string
        search_string = search_string
        whole_word_mode = whole_word_mode
      changing
        counter = counter
      exceptions
        error_cntl_call_method = 1
        invalid_parameter = 2.
    <b>Parameters</b>      <b> Description</b>    <b> Possible values</b>
    case_sensitive_mode    Upper-/lowercase       false Do not observe (default value)
                                                                       true  Observe
    replace_string                Text to replace the 
                                         occurrences of
                                         SEARCH_STRING
    search_string                 Text to be replaced
    whole_word_mode          Only replace whole words   false Find whole words and                                                                               
    parts of words (default                                                                               
    value)
                                                                               true  Only find whole words
    counter                         Return value specifying how
                                        many times the search string
                                        was replaced
    Regards,
      Jayaram...

  • How to replace a particular striing with another string in jtextpane

    how to get replace a particular string with another string of a jtextpane without taking the text in a variable using getText() method .

    Thanks for your answer,
    "relevant object" means for you datasources, transfer rules and transformations ?
    With the grouping option "Save for system copy" I can't take easily all datasources, and others objects
    Will I have to pick all object one by one ?
    What would be the adjustement in table RSLOGSYSMAP ? For the moment it's empty.
    Regards
    Guillaume P.

  • How to replace the char values into numeric in my string?

    Hi Friends,
    I would like to Replace the Charecter values with numeric value in my string.
    Exp : first in my string I am having the value like this : 'ABCD1234' ( may be any char and num values ), and I want too get it by '99991234'.
    I mean How to replace the char values into numeric in my string?
    Thanks,
    Sridhar

    Hi Sridhar,
    I would like to Replace the Charecter values with numeric value in my string.
    Exp : first in my string I am having the value like this : 'ABCD1234' ( may be any char and num values ), and I want too get it by '99991234'.
    So, if i understand you correctly, you want to replace all characters in a string with 9 as in the above example, irrespective of position of the character, if so try with the below code.
    DATA: l_str TYPE string.
    l_str = 'ASKHSIUDNSBDKJSDH124312431243124saasdfsf'.
    REPLACE ALL OCCURRENCES OF REGEX '\D' IN l_str WITH '9'.
    IF sy-subrc EQ 0.
      WRITE: l_str. "Result will be 9999999999999999912431243124312499999999
    ENDIF.
    Regards,
    Chen
    Edited by: Chen K V on Jun 13, 2011 12:36 PM

  • How to used REGEXP_REPLACE  for replace part of string ?

    hi
    How can i replace part of string as following , i want to replace space in date by "-"
    SELECT
    REGEXP_REPLACE(upper('Daivd bought stuff by 2000 USD on 12 Sep 2012 from KL and left kl on 20 Sep 2012'),
    '[0-9]{1,2}[^0-9](JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC)[^0-9][0-9]{4}',
    ' ','-') "REGEXP_REPLACE"
    FROM DUAL;
    the output will be like this
    Daivd bought stuff by 2000 USD on 12-Sep-2012 from KL and left kl on 20-Sep-2012
    regards

    I thought the questions is answered.
    Your code will not work, because the alternate expression applies only to the four digit year and the month.
    If you want to recognize both date formats with one expressions, you have to group the complete expressions.
    The disadvantage of this would be, that the backreferences would not work in the same way because you would have more groups.
    I advice to use two separate regular expressions for this task.
    Take a look at the following example if you simply want to fill the gaps with -:
    with yourtable as
      select 'Daivd bought stuff by 2000 USD on 12 Sep 2012 from KL and left kl on 20 Sep 2012' text from dual union all
      select 'Daivd bought stuff by 2000 USD on Sep, 20 2012 from KL and left kl on Sep, 20 2012' text from dual 
    SELECT
    REGEXP_REPLACE(
    REGEXP_REPLACE(text,
    '([0-9]{1,2}) (JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC) ([0-9]{4})','\1-\2-\3',1,0,'i'),
    '(JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC), ([0-9]{1,2}) ([0-9]{4})','\1-\2-\3',1,0,'i') regexp_replace
    FROM yourtable;If you want same output-format for both date formats you could use this:
    with yourtable as
      select 'Daivd bought stuff by 2000 USD on 12 Sep 2012 from KL and left kl on 20 Sep 2012' text from dual union all
      select 'Daivd bought stuff by 2000 USD on Sep, 20 2012 from KL and left kl on Sep, 20 2012' text from dual 
    SELECT
    REGEXP_REPLACE(
    REGEXP_REPLACE(text,
    '([0-9]{1,2}) (JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC) ([0-9]{4})','\1-\2-\3',1,0,'i'),
    '(JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC), ([0-9]{1,2}) ([0-9]{4})','\2-\1-\3',1,0,'i') regexp_replace
    FROM yourtable;Edited by: hm on 25.09.2012 22:00

  • How to replace NULL values from main table

    Dear all,
    I like to remove the NULL values from a main table field. Or the question is how to replace any part of the string field in MDM repository main table field.
    e.g.   I have a middle name field partly the value is NULL in some hundreds of records, I like to replace NULL values with Space
    any recommendation.
    Regards,
    Naeem

    Hi Naeem,
    You can try using Workflows for automatically replacing NULLs with any specific value.
    What you can do is: Create a workflow and set trigger action as Record Import, Record Create and Record Update. So, that whenever any change will occur in the repository; that workflow will trigger.
    Now create an assignment expression for replacing NULLs with any specific value and use that assignment expression in your workflow by using Assign Step in workflow.
    For exiting records, you will have to replace NULLs manually using the process given by Preethi else you can export those records in an Excel spreadsheet which have NULLs and then replace all NULLs with any string value and then reimport those records in your MDM repository.
    Hope this will solve your problem.
    Regards,
    Varun
    Edited by: Varun Agarwal on Dec 2, 2008 3:12 PM

  • How to replace obsolete download function module in ECC6.0?

    Hi Experts,
    How to replace obsolete download function module in ECC6.0?
    Thanks,
    Adi.

    Hi,
    DOWNLOAD is obsolete FM in ECC 6. To get the same functionality , we need to use
    CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG  method (It provides the File selection feature)
    and
    GUI_DOWNLOAD function module.(It downloads the internal table from program to presentation server)
    Please see the example below:
    Example:
    *CALL FUNCTION 'DOWNLOAD'
              EXPORTING
                   FILENAME            = p_filename
                   FILETYPE            = ‘DAT’
              TABLES
                   DATA_TAB            = T_DOWNL
              EXCEPTIONS
                   INVALID_FILESIZE    = 1
                   INVALID_TABLE_WIDTH = 2
                   INVALID_TYPE        = 3
                   NO_BATCH            = 4
                   UNKNOWN_ERROR       = 5
                   OTHERS              = 6.
    *End of deletion CH01-
    Replacement Method for above code:
    DATA: l_filename    TYPE string,
           l_filen       TYPE string,
           l_path        TYPE string,
           l_fullpath    TYPE string,
           l_usr_act     TYPE I.
    l_filename = P_filename.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
      EXPORTING
        DEFAULT_FILE_NAME    = l_filename
      CHANGING
        FILENAME             = l_filen
        PATH                 = l_path
        FULLPATH             = l_fullpath
        USER_ACTION          = l_usr_act
      EXCEPTIONS
        CNTL_ERROR           = 1
        ERROR_NO_GUI         = 2
        NOT_SUPPORTED_BY_GUI = 3
        others               = 4.
    IF sy-subrc = 0
          AND l_usr_act <>
          CL_GUI_FRONTEND_SERVICES=>ACTION_CANCEL.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME                        = l_fullpath
       FILETYPE                        = 'DAT'
      TABLES
        DATA_TAB                        = T_DOWNL
    EXCEPTIONS
       FILE_WRITE_ERROR                = 1
       NO_BATCH                        = 2
       GUI_REFUSE_FILETRANSFER         = 3
       INVALID_TYPE                    = 4
       NO_AUTHORITY                    = 5
       UNKNOWN_ERROR                   = 6
       HEADER_NOT_ALLOWED              = 7
       SEPARATOR_NOT_ALLOWED           = 8
       FILESIZE_NOT_ALLOWED            = 9
       HEADER_TOO_LONG                 = 10
       DP_ERROR_CREATE                 = 11
       DP_ERROR_SEND                   = 12
       DP_ERROR_WRITE                  = 13
       UNKNOWN_DP_ERROR                = 14
       ACCESS_DENIED                   = 15
       DP_OUT_OF_MEMORY                = 16
       DISK_FULL                       = 17
       DP_TIMEOUT                      = 18
       FILE_NOT_FOUND                  = 19
       DATAPROVIDER_EXCEPTION          = 20
       CONTROL_FLUSH_ERROR             = 21
       OTHERS                          = 22.

  • Two finger swipe replaces google search string

    MBP with Safari 6.0 experiencing this problem.  Another user was experiencing the issue here:
    http://www.ehmac.ca/mac-iphone-ipad-ipod-help-troubleshooting/99937-safari-two-f inger-swipe-bug-replaces-google-search-string-os-10-7-3-a.html
    I don't know where the bug reports are to follow up on it and I haven't seen any patches for it.  Any advice?  Specifically, I'd like to know how to file the bug (in case I find another) and to follow up on any existing issues.
    TIA,
    Scott

    Is there no place to track the status of the report or see any other outstanding issues so I don't bother filing duplicates?
    Never heard of such a function here. This method gets feedback to the people who count but it is completely behind the scenes. Part of Apple's "cards close to the chest" method of doing pretty much everything. You should have been looking at the "don't expect a response" screen after you hit the submit button on your bug report.
    If there is something that needs clarification, I suspect they will use e-mail to ask for it, but don't stay home waiting!
    Have you read Walter Isaacson's  biography of Steve Jobs? Things like this took on a new--if not satisfying--perspective for me after reading it. So far, it has persisted in their corporate culture in the after-Steve era..

  • How to replace the root tag in ABAP Mapping

    how to replace the root tag with the certain string in ABAP Mapping
    just like
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
         <name>Lawrence</name>
    </root>
    into
    <?xml version="1.0" encoding="UTF-8"?>
    <myRootElement>
         <name>Lawrence</name>
    </myRootElement>
    i don't want to implement it in message mapping
    please give me the sample code
    thanks in advance

    Use below code
    odocument = ixmlfactory->create_document( ).
    msgtype = odocument->create_simple_element(
    name = 'myRootElement'
    parent = odocument ).
    Thanks
    Praveen

  • How to determine the connection string to a SQLite database, in C# code

    Hello. I'm trying to figure out how to specify the connection string to a SQLite database, I would like to access using the following code:
    string connectionString = null;
    SqlConnection connection;
    SqlCommand command;
    SqlDataAdapter adapter = new SqlDataAdapter();
    DataSet ds1 = new DataSet();
    string sql = "SELECT DataName, Data, Id, UserId, DateLastUpdated FROM MainTable";
    connectionString = "Data Source=C:\\SQLITEDATABASES\\SQLITEDB1.sqlite;Version=3;";
    connection = new SqlConnection(connectionString);
    try
    connection.Open();
    command = new SqlCommand(sql, connection);
    catch
    The value I assigned to the variable connectionString, in the code above, I obtained somewhere from the Internet. It does not work. I'm using Visual Studio 2013, against the file sqlite-netFx451-setup-bundle-x86-2013-1.0.96.0.exe, which
    I installed, and got from
    here.
    My application's App.config file looks as follows:
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <configSections>
    </configSections>
    <connectionStrings>
    <add name="DC_Password_Saver.Properties.Settings.DC_Password_SaverConnectionString" connectionString="data source=&quot;C:\Users\patmo_000\Documents\Visual Studio 2013\Projects\DC Password Saver\DC Password Saver\DC Password Saver.db&quot;" providerName="System.Data.SQLite.EF6"/>
    </connectionStrings>
    <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
    </startup>
    </configuration>
    I tried to use the value assigned to connectionString in the XML settings above, replacing single backslash characters with double backslash characters, because the Visual Studio editor flagged them as unrecognizable, and wound up with the
    following.
    SqlDataAdapter adapter = new SqlDataAdapter();
    DataSet ds1 = new DataSet();
    string sql = "SELECT DataName, Data, Id, UserId, DateLastUpdated FROM MainTable";
    connectionString = "data source=&quot;C:\\Users\\patmo_000\\Documents\\Visual Studio 2013\\Projects\\DC Password Saver\\DC Password Saver\\DC Password Saver.db&quot;";
    connection = new SqlConnection(connectionString);
    The above code however does not work either. So again, does anyone know how I can specify in C# code, a connection string to access my SQLite database? Thanks in advance for your reply.

    What does SQLite connection strings has to do with WPF?
    You will find some valid connection strings here:
    https://www.connectionstrings.com/sqlite/
    But you cannot use the SqlConnection class to connect to a SQLite database. You will need to download and add a reference to the System.Data.SQLite library and then use the SQLiteConnection class:
    connection = new System.Data.SQLite.SQLiteConnection(connectionString);
    try
    connection.Open();
    command = new System.Data.SQLite.SQLiteCommand(sql, connection);
    catch
    Please refer to the following article for more information and an example of how to connect and read and write data from an SQLite database using C#:
    http://blog.tigrangasparian.com/2012/02/09/getting-started-with-sqlite-in-c-part-one/.
    There is contains a link where you can download the required assemblies.
    Hope that helps.
    Please remember to mark helpful posts as answer to close your threads and then start a new thread in an approproate forum if you have a new question.

  • Replace the connection string in Excel MDS file

    I had MDS solution from one SQL Server 2012 to another - SQL Server 2014. I have configured Excel file with connection to MDS. How can I safely to replace the connection string in my Excel MDS file and the tables is not broken?
    from Moscow with money

    Hi,
    Excel is just used to manage data and create new entities and attributes. Why not first publish and close your excel before MDS upgraded to 2014? After the upgrade, reconnect new solution in your excel.
    thanks,
    Jerry

Maybe you are looking for

  • Problem with sap logon/bex

    Hello Peoples, I have a machine is the same with Windows Vista Home Premium, sap logon 7.10 - patch 11 Access to the SAP system is perfect, but when I try to open the Bex query designer after informing username and password I get the error of communi

  • Aktivierung nur 20 mal

    Hallo, nochmals einen schönen guten Abend, mit Erschrecken habe ich heute Abend im Kleingedruckten gelesen, dass Photoshop nur 20 mal zu aktivieren ist. Ich habe bisher einige Male auf verschiedenen PC's gearbeitet und mein CS 2 immer deaktiviert und

  • Macbook pro doesn't turns on

    i have a late 2011 13" macbook pro! i was using it while it turned off and it wont start again.! I tried to make the SMC reset.! But all i got to hear was fan noise I don't know what to do now! please help

  • Where did Verizon service go?

         I have a Verizon LG Cosmos 3 prepaid phone, and it is impossible to get an actual person by calling them.  In the past, I pressed 0 from their IVR and I was able to get an operator.  That was disabled.  First, I should have account owner status.

  • Spam showing up in inbox then disappearing

    So for a long time now, back when I had my iPhone 4 and now on my iPhone 5, I will sometimes get a new e-mail and it will clearly be spam but in my inbox. I know I know, spam does sometimes get into your inbox, but there is something much weirder goi