' character in the string

Hello.
I'm trying to insert string to varchar value in the database which contains the ' character. But it throws the error....
how can i replace this character to some another character in the string before inserting it to the database?
thanks

public String replace(char oldChar,
char newChar)Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar.
Fred

Similar Messages

  • Replace a character in the string using JavaScript

    Hello,
    I would like to ask for help. I have a field in the xml file, which contains a string, that is bound to a text box on the form.
    What would be the syntax to replace a special character in the string with the carriage return?
    Thank you.

    Huh?
    I didn't post my script...
    It sure is no clean programming since I just took Steve's solutions and delted the ligns I didn't want (the app allert)
    Though in the end I've taken the boolean out, or better replaced it with the replacement function, it repeats the replacement no matter how much "ü"'s are in there. (I needed the boolean though, since as long as it was true, the if should be executed.)
    Somehow it worked... not 100% sure why, but it worked.
    if (findChar(this.rawValue)) {
    function findChar(str)
    {  for (var i=0; i < str.length; i++)
            if (str.charAt(i) == "ü")
               this.rawValue = this.rawValue.replace(/ü/,"ue")

  • NewLine Character in the String received from Interactive Adobe Form

    Hello Experts,
    Following is the issue we have with interactive Adobe Form
    We have a text area within the form. User enters the text in multiple lines in this text area.
    We are calling a backend function module designed in SE37 that accepts and process the data from the adobe form.  We are also processing the string data user enters in the text area.
    When we receive the string from the form, the newline character within the string is displayed as '#' in the debugger. We tried splitting this string using cl_abap_char_utilities=>newline and cl_abap_char_utilities=>cr_lf  but NO luck. Though in the debugger we see cl_abap_char_utilities=>newline  as '#'  in the debugger and also '#' is present within the string, for some reason when string is processed to find cl_abap_char_utilities=>newline, we can find/locate it.
    Because ABAP code is not able to identify the newline character within the string received from Adobe form, we are not able to maintain the formatting of the string as it was entered in the form.
    Any help to resolve this issue is appreciated.
    Thanks in Advance.
    Regards,
    Bhushan

    Hi Bhushan,
    I was going through your issue, and I feel this is something you can do with scripting. Basically you should read whole string and find the new line character and replace with a space or comma, as per your requirment.
    Do like following:
    In the exit event of the field select java script and write following code:
    var strng = this.rawValue;
    strng.replace(/\n/g, " ");
    above im reaplcing new line with a space.
    I think it should work I have not tested it. Pls update if you test it .
    Regards,
    Ravi.D

  • Special character '  in the string variable

    Hi,
    I need to insert in the string veriable the special character '. How should I do it ?
    variable = '''.
    It does not work ...
    BR
    Wojcieh

    1)Declare a variable and assign the special character to that variable.
    2)Then use the CONCATENATE option to get the value in the string variable.
    Just copy and execute this code.
    REPORT zztest.
    <b>DATA : temp(1) VALUE ''''.</b> Decalare your special character
    DATA : variable TYPE string.
    START-OF-SELECTION.
      BREAK-POINT.
      variable = 'SDNSAP'.
      CONCATENATE temp variable temp INTO variable.
      WRITE : / variable.
    <b>The output is</b>
    'SDNSAP'
    Regards,
    AS.

  • What does the trim() method of the String class do in special cases?

    Looking here ( String (Java Platform SE 7 ) ), I understand that the trim() method of the String class "returns a copy of the string, with leading and trailing whitespace omitted", but I don't understand what the last special case involving Unicode characters is exactly.
    Looking here ( List of Unicode characters - Wikipedia, the free encyclopedia ), I see that U+0020 is a space character, and I also see the characters that follow the space character (such as the exclamation mark character).
    So, I decided to write a small code sample to try and replicate the behaviour that I quoted (from the API documentation of the trim method) in the multi-line comment of this same code sample. Here is the code sample.:
    public class TrimTester {
        public static void main(String[] args) {
             * "Otherwise, let k be the index of the first character in the string whose code
             * is greater than '\u0020', and let m be the index of the last character in the
             * string whose code is greater than '\u0020'. A new String object is created,
             * representing the substring of this string that begins with the character at
             * index k and ends with the character at index m-that is, the result of
             * this.substring(k, m+1)."
            String str = "aa!Hello$bb";
            System.out.println(str.trim());
    However, what is printed is "aa!Hello$bb" (without the quotes) instead of "!Hello$" (without the quotes).
    Any input to help me better understand what is going on would be greatly appreciated!

    That's not what I was thinking; I was thinking about the special case where the are characters in the String whose Unicode codes are greater than \u0020.
    In other words, I was trying to trigger what the following quote talks about.:
    Otherwise, let k be the index of the first character in the string whose code is greater than '\u0020', and let m be the index of the last character in the string whose code is greater than '\u0020'. A new String object is created, representing the substring of this string that begins with the character at index k and ends with the character at index m-that is, the result of this.substring(k, m+1).
    Basically, shouldn't the String returned be the String that is returned by the String class' substring(3,9+1) method (because the '!' and '$' characters have a Unicode code greater than \u0020)?
    It seems to not be the case, but why?

  • Count a character within a string

    Give a string, what function can I use to count how many a particular character in the string. For example:
    "abc;def;ghi;xyz"
    I want to find out how many ";" in this string.
    Thank you

    And of course, if the researched character is not in the given string, then you'll return null, to return 0, you'll need a NVL.even if it is in the string you might need a nvl in Vamsi Kasina's solution:
    SQL>  select length (';') - length (replace (';', ';')) cnts
      from dual
          CNTS
    1 row selected.Better:
    SQL>  select nvl(length (';'),0) - nvl(length (replace (';', ';')),0) cnts
      from dual
          CNTS
             1

  • Hi, Occurrences Of Every Character In A String

    Hi All,
    I want to write a program wherein I can check the occurrences of every character in the string given.
    What should I do, is there a in built function to do this.
    Please help

    I wrote this program and this works fine... Thanks
    public class Main_Character_Occurence
        public static void main(String args[])
            String inputString = " Test String";
            String matches = "abcdefghijklmnopqrstuvwxyz";
            int sum = 0;
            for (int i = 0; i < matches.length(); i++)
                for (int ctr = 0; ctr < inputString.length(); ctr++)
                    if (matches.charAt(i) == Character.toLowerCase(inputString
                        .charAt(ctr)))
                        sum++;
                System.out.println(matches.charAt(i) + "=" + sum);
                sum = 0;
    }The output I am getting is this
    a=0
    b=0
    c=0
    d=0
    e=1
    f=0
    g=1
    h=0
    i=1
    j=0
    k=0
    l=0
    m=0
    n=1
    o=0
    p=0
    q=0
    r=1
    s=2
    t=3
    u=0
    v=0
    w=0
    x=0
    y=0
    z=0

  • I would like to do a program that have one string control and one string indicator, any character that I type in the string control in the same time it will be appear in another string (indicator). How can help me?

    I would like to do a program that have one string control and one string indicator, any character that I type in the string control in the same time it will be appear in another string (indicator). How can help me?

    Why not use an event
    Add a While Loop, inside the loop add the Event Sructure.
    Now in the event structure selecd the String Controls.value change event to
    react
    and the new value inside the event that you get,( connect to the String
    indicator box.
    On Sun, 10 Aug 2003 15:58:47 -0500 (CDT), WiltonFilho wrote:
    > I would like to do a program that have one string control and one
    > string indicator, any character that I type in the string control in
    > the same time it will be appear in another string (indicator). How can
    > help me?
    >
    > I would like to do a program that have one string control and one
    > string indicator, any character that I type in the string control in
    > the same time it will be appear in another string (indicator). How can
    > help me?
    >
    Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

  • How to escape the character in a string?

    I have the following code that is causing an error. I'm
    attempting to use < (less than) character in a string that is
    part of a dynamic query:
    <cfif url.age eq 1>
    <cfset askAge = " < 15">
    <cfelseif url.age eq 10>
    <cfset askAge = " Between 56 and 60">
    <cfelseif url.age eq 11>
    <cfset askAge = " > 60">
    </cfif>
    The error occurs as a result of the line <cfset askAge = "
    < 15">. The > 60 works fine. What I need is to build the
    SQL statement SELECT * FROM myTable WHERE age < 15
    ColdFusion sets the string properly but when I try to run the
    query I guess it thinks I'm trying to open a tag. The exact error
    is:
    The content beginning "< " is not legal markup. Perhaps
    the " " (&#20;) character should be a letter.
    The content beginning "< " is not legal markup. Perhaps
    the " " () character should be a letter.
    I can't use the ASCII code for this character as the database
    will obviously crap out.
    Any help would be greatly appreciated and many thanks in
    advance.
    Dave

    Dave,
    What if you passed off the output of the lt/gt symbols to the
    query itself?
    Something like,
    <cfif url.age eq 1>
    <cfset compareOperator = "less"/>
    <cfset askAge = "15">
    <cfelseif url.age eq 10>
    <cfset compareOperator = "between"/>
    <cfset askAge = " 56 and 60">
    <cfelseif url.age eq 11>
    <cfset compareOperator = "greater"/>
    <cfset askAge = "60">
    </cfif>
    Then in the query:
    <cfquery name="qTest" datasource="dsn">
    SELECT * FROM myTable
    WHERE age
    <cfswitch expression="#compareOperator#">
    <cfcase value="less">
    <
    </cfcase>
    <cfcase value="greater">
    >
    </cfcase>
    <cfcase value="between">
    BETWEEN
    </cfcase>
    <cfdefaultcase>
    =
    </cfdefaultcase>
    </cfswitch>
    #askAge#
    </cfquery>
    Probably a better way, at least a more efficient way, but
    just a thought...cfswitch processed pretty quickly and this would
    remove any issues with trying to use <> symbols.
    Cheers,
    Craig

  • How to check the occurrence of a character in a string

    Hello Experts,
    I have a scenario where in I have to check the occurrence of a character in a string and based on that I have to pass a data into target field.
    I was wondering whether this can achieved with mapping functions or Do I have to use an UDF.
    Thanks in advance.
    Regards
    Advit Ramesh

    Hi Advit,
    You can achieve this by using standard function indexOf from the text category. Pass in the input string and the character value you want to check for as the input.
    Standard Functions (SAP Library - SAP Exchange Infrastructure)
    If the output is -1, then the character is not in the string, otherwise it is.
    Rgds
    Eng Swee

  • The first character in a string

    I need to return the first character of a string, convert it to an integer, and compare it with another integer to see if they're the same. Sounds simple, even for me, but it won't work!!!
    // First question >
    Object userValue1 = JOptionPane.showInputDialog("Blah Blah Blah", JOptionPane.PLAIN_MESSAGE, null, options1, options1[0]);
    Variables.placeholder = (int) userValue1.charAt(0);This is the error I get
    C:\Documents and Settings\imholt\My Documents\OOPAttempt\21_Questions\Engine.java:170: cannot resolve symbol
    symbol : method charAt (int)
    location: class java.lang.Object
              Variables.placeholder = (int) userValue1.charAt(0);
    ^
    1 error
    I have a sneaky suspicion that once I find out what the problem was, I will ask myself why I didn't see it before...

    Try this
    Object userValue1 = JOptionPane.showInputDialog("Blah Blah Blah", JOptionPane.PLAIN_MESSAGE, null, options1, options1[0]);
    String str = userValue1.toString();
    Variables.placeholder = (int) str.charAt(0);

  • Having the '\' character in a string

    I get errors when I try to construct a string, say like this:
    String blahblah = new String("IBM\ROOT\IMAGE");
    Basically it seems like I can't store that '\' character in a string at all. Is this true?
    Thanks in advance.

    the '\' character is used to indicate an escape sequence, used for things like '\n' (new line). To do what you want you can do this:
    String blahblah = new String("IBM\\ROOT\\IMAGE"); //notice the double slash '\\' you would also have to do this for double and single quotes, e.g. ( new String("Bill said, \" Anne told me to \'go home now\'\"") : for... Bill said, "Anne told me to 'go home now'")

  • Inserting the "enter" character in a String

    Hi,
    I would like to insert a "enter" character in a String to create a new line.
    something like this
    String test = "teste" + char(10) + "teste";
    Thanks in advanced
    Ricardo

    Are you trying to do this in an email? You didn't mention that. If your email encoding doesn't support new lines (the most simple encoding doesn't) you can't send them. I don't know why you'd get those results though, unless you actually put "\\n\\r" in the Java program.
    Anyway, it's not "my solution" it's just a fact. '\n' is the newline character and '\r' is the carriage return character.

  • How to replace only the first specified character in a string and leave other occurrence of the character alone.

    Hello my Friends:
    I have a string that looks like this in a column:
    Hello, World, Hello, Planet
    I want to replace only the first occurrence so that the result looks like this:
    Hello World, Hello, Planet
    Working on some bad data source.
    I need to replace the character regardless of it's location as long as it is the first.
    I tried something like this, but I soon discovered that if the comma or character is missing the the string may get truncated or altered. If there are no characters in the string, then I want to simply leave it alone.
    Here is where I am at:
    DECLARE @MyValue NVARCHAR(MAX) = 'Hello, World, Hello, Planet';
    SELECT MyString = STUFF('Hello, World', CHARINDEX(',', @MyValue, 0), 1, ' ');
    Thanks my friends.

    I have a string that looks like this in a column:
    Hello, World, Hello, Planet
    Why doesn't it say Hello Kitty?
    Oh, sorry about that. Anyway:
    SELECT MyString = CASE WHEN CHARINDEX(',', @MyValue, 0) >= 1
                           THEN STUFF(MyString, CHARINDEX(',', @MyValue, 0), 1, ' ')
                           ELSE MyString
                     END;
    Erland Sommarskog, SQL Server MVP, [email protected]
    Erland, love you sense of humor!! :)
    Thanks for the solution.

  • How to split the string from character position.

    HI ALL,
    I need to split the string like this.
    example:
    String = "HelloWorld"
    mid("HelloWorld", 2, 5);
    it should print   "ello"
    menas mid is functiuon it will split "HelloWorld" from 2nd character to 5th character and prints "ello".
    This one how to do in labview.
    Regards
    Punith

    String Subset is the function you are looking for.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

Maybe you are looking for

  • How to mirror ipad2 to non hdmi tv

    How can I mirror my ipad2 to a non HDMI tv.  I have a plasma tv that takes rca and component cables

  • My new 4S is set to slide to unlock and I don't know how to answer a call.

    I don't knpw how the configuration changed but it switched from slide to answer to slide to unlock. I don't know how to answer a call and want to get the configuration back to skide to answer. How do I do that?

  • Menu Exit Code

    Hello All, I wanted a Menu Item in the SAP Standard Menu Bar. i.e the SYSTEM,  HELP menu . So, for the above I went to the Screen Painter SE41--> Program --> MENUSYST --> Status > MEN> Change . Here under the Help Menu - I added one more item with Te

  • Windows 8.1, transparency and tabs unreadable

    I have a new install of Firefox on a new Alienware M15x laptop. No extensions, up-to-date drivers; it is a brand new install. And, because of either Firefox or Windows, my tabs are all transparent, so if there is anything behind firefox other than th

  • Facebook contacts won't sync into phone contacts iOS 6

    So I had all my Facebook contacts linked nicely with my phone. And yes I liked having everyone's information in my phone. But suddenly all my facebook contacts have disappeared from my contacts. I've tried togglying sync with contacts button and sign