Need help in replacing special characters in a string

Hi,
please let me know the best way to replace all the special characters in a string with space.
other than alphabets and numbers
with regards.
sumanth.

please let me know the best way to replace all the special characters in a string with space.
other than alphabets and numbers
>
Sumanth Nag Kristam wrote:
> actually i need to replace hexa decimal char 0X1A in a string.... that is 'substitue' as per the chart
> any pointers....
>
> chk the link for the ASCII codes
> http://www.techonthenet.com/ascii/chart.php
But in Hexa decimal value there is no special characters?

Similar Messages

  • Replace Special Characters in a string + XQUERY

    Hi All,
    I am using the following replace function to replace the special characters in my XQUERY.
    *replace($string1, '[&"-*;-`!|:,¿/{}@#$%^*~()_+-]', ' ')*
    Fortunately it is replacing all the special characters. But the only problem here is it is even replacing capitol letters in to spaces, which I don't want.
    Please help me out!!

    Hi
    <<< What did u change >?> I dont see any change with the Regex ?  >>
    if you observe in the modified function, he just removed (*) inside the replace funtion.
    Thanks
    Shankar AUNV

  • Help with replacing special characters and how/where to put the javascript...

    Hey there
    A while ago I added javascript to some parts of my PDF around the use of dates and phone numbers, I now have Acrobat 11, and I am at a loss of how to add a new javascript (i cant remember at all) the code I have is
    if (!event.willCommit) {
        event.change = event.change.replace(/\, "-");
    and it does not appear to be working, but if the code is right, then I am guessing I am putting it in the wrong place.
    Any help would be awesome.
    Cheers

    Probably like this:
    // Custom Keystroke script
    if (!event.willCommit) {
        event.change = event.change.replace(/\, "-");
        event.change = event.change.toUpperCase();
    If it doesn't work, post what the other script is and where it's placed.

  • Replace Special Characters in a String

    Let's say someone copies the folowing list and pastes it into a Javascript prompt box:
    302304
    305678
    245675
    How do I manipulate the string so it reads:
    302304 305678 245675
    In other words, how do I replace the manual line breaks in a string with spaces?
    Thanks!

    \r and \n are both \s characters.
    This is functionally equivalent to what you have...
    stringName = stringName.replace(/\s/g,' ');
    I highly recommend browsing this website (lots of useful info there):
    http://www.regular-expressions.info/
    Harbs

  • Vbscript to rename files and replace special characters

    Dear Exprt,
    would you please help to add addtional requirement for rename and replace special characters for file
    by the below script i can re name.
    strAnswer = InputBox("Please enter folder location to rename files:", _
        "File rename")
        strfilenm = InputBox("Enter name:", _
        "Rename Files")
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Sub visitFolder(folderVar)
        For Each fileToRename In folderVar.Files
            fileToRename.Name = strfilenm & fileToRename.Name
        Next
        For Each folderToVisit In folderVar.SubFolders
            visitFolder(folderToVisit)
        Next
    End Sub
    If FSO.FolderExists(strAnswer) Then
        visitFolder(FSO.getFolder(strAnswer))
    End If
    [email protected]

    Thx would you please look below what wrong in its run  nothing happend no error
    strAnswer = InputBox("Please enter folder location to rename files:", _
        "Test")
        strfilenm = InputBox("Enter name:", _
        "Rename Files")
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set regEx = New RegExp
    'Your pattern here
    Select Case tmpChar
    Case "&"
    changeTo = " and "
    Case "/"
    changeTo = "_"
    Case Else
    changeTo = " "
    End Select
    regEx.Pattern = tmpChar 
    Sub visitFolder(folderVar)
        For Each fileToRename In folderVar.Files
            fileToRename.Name = strfilenm & fileToRename.Name 
            fileToRename.Name = regEx.Replace(fileToRename.Name, tmpChar)
        Next
        For Each folderToVisit In folderVar.SubFolders
            visitFolder(folderToVisit)
        Next
    End Sub
    [email protected]

  • How to replace special characters in string.

    Hello,
    I want to replace special characters such as , or ; with any other character or " ".I find out there is no such function is java for this.There is only replace() but it accepts only chars.If anybody know how to do this?.
    Thanks,

    Hello,
    I want to replace special characters such as , or ;
    with any other character or " ".I find out there is no
    such function is java for this.There is only replace()
    but it accepts only chars.If anybody know how to do
    this?.
    Thanks,Can't you just do the following?
    public class Test
         public static void main(String[] args)
         String testString = "Hi, there?";
         System.out.println(testString.replace(',',' '));
    }

  • Need Help in Replacement of Function Modules

    Hello all,
    I am working on Upgrade project from ECC 5.0 to ECC 6.0. I am facing problems for Replacement of two Obsolete Function Modules. Please give me a solution. FM's  are as follows.
    1) SET_AUTHORITY : This FM is obsolete in ECC 6.0 and there is not alternative FM present in help.sap.com or any other web portal.
    2) WS_QUERY : Here as per my knowledge we use class CL_GUI_FRONTEND_SERVICES and methods FILE_EXIST or DIRECTORY_EXIST as per the parameters in old FM. For parameter 'FS' we use 'FILE_EXIST' and 'DS' we use 'DIRECTORY EXIST'.
    But in our program prev. FM has parameter 'OS' i.e. Operating System.
    But there is not method called 'OS EXIST' or similar. Please suggest suitable method.
    Thanking you all in anticipation.
    Best Regards,
    Harish

    Hi Harish,
                       I too could not find any replacement for SET_AUTHORITY
    Obsolete Modules can be used in newer versions, but it is not supported by SAP in case of any technical issues.If you still need a replacement, you can replace it by the source code in the FM SET_AUTHORITY itself and modify according to your needs.
    Below is the source code of FM SET_AUTHORITY, so you can modify it according to your requirement.
      DATA: l_actvt  TYPE tact-actvt,
            l_hier   TYPE STANDARD TABLE OF sethier WITH HEADER LINE.
      CASE action.
        WHEN 'A    '.
          l_actvt = activity-add.
        WHEN 'C    '.
          l_actvt = activity-modify.
        WHEN 'D    '.
          l_actvt = activity-display.
        WHEN 'E    '.
          l_actvt = activity-delete.
        WHEN 'UD   '.
          l_actvt = activity-display.
      ENDCASE.
      CALL FUNCTION 'G_SET_TREE_IMPORT'
           EXPORTING
                no_descriptions  = 'X'
                no_rw_info       = 'X'
                setid            = set
                tabname          = table
                root_header_only = 'X'
           TABLES
                set_hierarchy    = l_hier
           EXCEPTIONS
                OTHERS           = 0.
      READ TABLE l_hier INDEX 1.
      IF sy-subrc <> 0.
        CLEAR l_hier.
        l_hier-shortname = set.
      ENDIF.
      CALL FUNCTION 'G_SET_AUTHORITY_CHECK'
           EXPORTING
                actvt  = l_actvt
                authgr = l_hier-authgr
           EXCEPTIONS
                OTHERS = 1.
      IF sy-subrc <> 0.
        CASE action.
          WHEN 'A    '.
            MESSAGE e827 WITH l_hier-shortname RAISING no_authority.
          WHEN 'C    '.
            MESSAGE e828 WITH l_hier-shortname RAISING no_authority.
          WHEN 'D    '.
            MESSAGE e829 WITH l_hier-shortname RAISING no_authority.
          WHEN 'E    '.
            MESSAGE e830 WITH l_hier-shortname RAISING no_authority.
          WHEN 'UD   '.
            MESSAGE e831 WITH l_hier-shortname RAISING no_authority.
        ENDCASE.
      ENDIF.
    If you need help in replacing in the above source code, please post your code here so that I can help you in modifying accordingly.
    Regards,
    Vasuki

  • How to search special characters in a string

    Hi all,
    I want to search special characters in all string columns and all rows in the table.
    The table has about 5 string columns and about 5.000.000 rows. For each row and column, I have to search entries, which included special characters like ", !, ? or something else (f.ex. "Mama?Mia" or "!!!Hotel out of order!!!"). The problem, the character could stand at each position in the string.
    What's the best and most performance possibility to search such entries?? Is it possibility only by SQL; is there a special function for this?? Or must I use PL/SQL.
    Thanks for helping
    Dana

    HTH
    Laurent Schneider
    OCM DBA
    SQL> select * from z;
    S
    Mama?Mia
    a b c
    123
    SQL> select * from z where translate(s,'~ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz1234567890','~') is not null;
    S
    Mama?Mia
    SQL> select * from z where regexp_like(s, '[^[:alnum:][:space:]]');
    S
    Mama?Mia

  • Sample code to identify special characters in a string

    Hi,
    I need to identify special characters in a string.... could anybody send me some code please.......
    Thanks,
    Best regards,
    Karen

    data: str(100) type c.
    data: str_n type string.
    data: str_c type string.
    data: len type i.
    data: ofst type i.
    str = '#ABCD%'.
    len = strlen( str ).
    do.
      if ofst = len.
        exit.
      endif.
      if str+ofst(1) co sy-abcde.
        concatenate str_c str+ofst(1) into str_c.
      else.
        concatenate str_n str+ofst(1) into str_n.
      endif.
      ofst = ofst + 1.
    enddo.
    write:/ str.
    write:/ str_c.
    write:/ 'spacial chracter',20 str_n.
    Function module  <b>SF_SPECIALCHAR_DELETE</b> <b>DX_SEARCH_STRING</b>
    l_address1 = i_adrc-street.
    CHECK NOT L_ADDRESS1 IS INITIAL.
    len = STRLEN( l_address1 ).
    do len times.
    if not l_address1+l(1) ca
    'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '.
    if i_adrc-street+l(1) CO sy-abcde.
    elseif i_adrc-street+l(1) CO L_NUMCHAR.
    exit.
    endif.
    l = l + 1.
    enddo.
    data : spchar(40) type c value '~!@#$$%^&()?...'etc.
    data :gv_char .
    data:inp(20) type c.
    take the string length .
    len = strlen (i/p).
    do len times
    MOVE FNAME+T(1) TO GV_CHAR.
    IF gv_char CA spchar.
    MOVE fnameT(1) TO inp2T(1).
    ENDIF.
    T = T + 1.
    enddo.
    REPORT ZEX4 .
    PARAMETERS: fname LIKE rlgrap-filename .
    DATA: len TYPE i,
    T TYPE I VALUE 0,
    inp(20) TYPE C,
    inp1(20) type c,
    inp2(20) type c,
    inp3(20) type c.
    DATA :gv_char.
    data : spchar(20) type c value '#$%^&*()_+`~'.
    START-OF-SELECTION.
    CONDENSE fname.
    len = strlen( fname ).
    WRITE:/ len.
    DO len TIMES.
    MOVE FNAME+T(1) TO GV_CHAR.
    IF gv_char ca spchar.
    MOVE fnameT(1) TO inpT(1).
    ENDIF.
    T = T + 1.
    ENDDO.
    CONDENSE INP.
    write:/ 'Special Characters :', inp.
    Rewards if useful..........
    Minal

  • RegExp for excluding special characters in a string.

    Hi All,
    Im using Flex RegExpValidator. Can anyone suggest me the correct expression to validate this condition?....
    I have tried this expression :----- /^[^///\/</>/?/*&]+$/...But in this it is also negating the alphabets.Also I have tried with opposite condition that in the String we should have alphabets and the expression is:-- ([a-z]|[A-Z]|[0-9]|[ ]|[-]|[_])*..... Please can anyone help me on this.
    Thanks in advanced to all.
    Munira

    sorry but you are posting things back that do not make any sense
    what do you mean with the below comment?
    munira06 wrote:
    Yes you are correct ,but I have tried this with single special character
    say
    Re: RegExp for excluding special characters in a string.
    here is a sample app taken from the live docs
    using ^[a-zA-Z0-9 \-_]*$ as the regex accepts all characters from a-z, A-Z, 0-9 - [space] and_
    run the example tell me what regex you are using and what test strings fail when they should pass or pass when they should fail
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Simple example to demonstrate the RegExpValidator. -->
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:mx="library://ns.adobe.com/flex/mx">
        <fx:Script>
            <![CDATA[
                import mx.events.ValidationResultEvent;
                import mx.validators.*;
                // Write the results to the
                private function handleResult(eventObj:ValidationResultEvent):void {
                    if (eventObj.type == ValidationResultEvent.VALID) {
                        // For valid events, the results Array contains
                        // RegExpValidationResult objects.
                        var xResult:RegExpValidationResult;
                        reResults.text = "";
                        for (var i:uint = 0; i < eventObj.results.length; i++) {
                            xResult = eventObj.results[i];
                            reResults.text=reResults.text + xResult.matchedIndex + " " + xResult.matchedString + "\n";
                    } else {
                        reResults.text = "";
            ]]>
        </fx:Script>
        <fx:Declarations>
            <mx:RegExpValidator id="regExpV"
                    source="{regex_text}" property="text"
                    flags="g" expression="{regex.text}"
                    valid="handleResult(event)"
                    invalid="handleResult(event)"
                    trigger="{myButton}"
                    triggerEvent="click"/>
        </fx:Declarations>
        <s:Panel title="RegExpValidator Example"
                width="75%" height="75%"
                horizontalCenter="0" verticalCenter="0">
            <s:VGroup left="10" right="10" top="10" bottom="10">
                <s:Label width="100%" text="Instructions:"/>
                <s:Label width="100%" text="1. Enter text to search. By default, enter  a string containing the letters ABC in sequence followed by any digit."/>
                <s:Label width="100%" text="2. Enter the regular expression. By default, enter ABC\d."/>
                <s:Label width="100%" text="3. Click the Button control to trigger the validation."/>
                <s:Label width="100%" text="4. The results show the index in the text where the matching pattern begins, and the matching pattern. "/>
                <mx:Form>
                    <mx:FormItem label="Enter text:">
                        <s:TextInput id="regex_text" text="xxxxABC4xxx" width="100%"/>
                    </mx:FormItem>
                    <mx:FormItem label="Enter regular expression:">
                        <s:TextInput id="regex" text="ABC\d" width="100%"/>
                    </mx:FormItem>
                    <mx:FormItem label="Results:">
                        <s:TextInput id="reResults" width="100%"/>
                    </mx:FormItem>
                    <mx:FormItem >
                        <s:Button id="myButton" label="Validate"/>
                    </mx:FormItem>
                </mx:Form>
            </s:VGroup>
        </s:Panel>
    </s:Application>

  • Replacing special characters from xml document/text inside element

    Hi
    Is there any way to replace the xml codes to special characters inside an entire xml document/ for a text in element.
    I want to get the xml codes to get replaced to respective special character(for any special character)
    Please see the sample xml xml element below
    <Details>Advance is applicable only for &lt; 1000. This is mentioned in Seller&apos;s document</Details>
    Thanks in advance .. any help will be highly appreciated.

    So, just to be sure I understand correctly, you want this :
    <Details>Advance is applicable only for &lt; 1000. This is mentioned in Seller&apos;s document</Details>
    to be converted to :
    <Details>Advance is applicable only for < 1000. This is mentioned in Seller's document</Details>
    If so, I'll say again : the resulting XML document will be invalid.
    Extensible Markup Language (XML) 1.0 (Fifth Edition)
    The ampersand character (&) and the left angle bracket (<) MUST NOT appear in their literal form, except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they MUST be escaped using either numeric character references or the strings " &amp; " and " &lt; " respectively. The right angle bracket (>) may be represented using the string " &gt; ", and MUST, for compatibility, be escaped using either " &gt; " or a character reference when it appears in the string " ]]> " in content, when that string is not marking the end of a CDATA section.
    Ask whoever "they" are why they would want to work with not wellformed XML.

  • Replace all special characters in a String with underscore

    I have a String which contains some special characters even(!,$,@,*....).
    I need to replace all the special characters with _ in my String. I do have an idea of using String.replace() and analogous forms, but I would be thankful if anyone can suggest me of a better and an efficient way.
    regards,
    fun_one

    Kaj,
    Thx for your earnest reply. I did have a peep into the API on this method. But the regular expression that I need to use here was beyond my understanding. It did specify some regex that I put to use (something like myString("\D","_"), assuming that I need to replace all non-digit characters ), but it really did not help me getting the result.
    Would you spare some code for me reg. the usage of regular expressions in such a scenario?
    cheers,
    fun_one

  • Replacing 'special' characters

    Hi all,
    I was wondering if thers is a function module, class (method) or whatever (codepage translation) to convert 'special' characters like:
    è, é, ë, ï, etc with respectively e, e, e, i?
    More generally speaking we need to convert all characters (whether it be Unicode, Latin-1, etc.) to plain text containing only the letters of the alphabet from a-z and A-Z.
    Kind regards,
    Micky.

    @ Rainer,
    both thanks a lot for your relevant replies which are quite helpful. And I do think that we still needs some sort of intermediate table to hold at least some characters to be translated/converted into plain text.
    @ Gautham,
    I'm currently testing this function module with several codepages (parameter INTER_CP) beside the default codepage 1146. For characters like ë and ï this is definitely the way to go, but when using some characters that are really out there like ¥ŖßÞu0152u03A9u03C6, we still seem to be needing an intermediate table to replace these characters.
    But again, some very helpful answers.
    P.S. Although both answers are potentially worth 10 pts, It only seems fair to give you both the credit you deserve.

  • Replace special characters in FDF

    Hello,
    I have searched everywhere and cannot find the answer to this simple problem.  I can manipulate javascript in an HTML environment by using free scripts, but it's not so easy in a PDF form.  I am using Adobe Acrobat 9 Pro and I have a form that when filled out and submitted, generates and emails an FDF file.  I am using a server-side script called FormGenie to do this, and the script hates parentheses and some other special characters, they break the FDF file.  All I want to do is set up a document level Javascript that will check for and replace all instances of these special characters with something allowed like a hyphen- or just a space.
    I have tried:
    function clearText() {
         document.formname.fieldname.value=filterNum(document.formname.fieldname.value)
         function filterNum(str) {
              re = /\$|#|~|\%|\*|\^|\(|\)|\+|\=|\[|\]|\[|\}|\{|\;|\"|\<|\>|\?|\||\\|\!|\$/g;
              // remove special characters like "$" and "," etc...
              return str.replace(re, "-");
    and
    function clearText2(str) {
    stringName = stringName.replace(/\$|#|~|\%|\*|\^|\(|\)|\+|\=|\[|\]|\[|\}|\{|\;|\"|\<|\>|\?|\||\\|\!|\$ /g,'-');
    I know these aren't right, but I have to be at least barking up the right tree.
    Can someone help?
    Thank you

    OK, here is my first stab at putting together this  script from searching the API reference.
    To loop  through the text fields and get their values, I have:
    for  ( var i = 0; i < this.numFields; i++) {
    var fname = this.getNthFieldName(i);
    if ( fname.type = "text" ) f.value;   [Not sure if "f.value" is correct or legal here]
    If this is even getting close, where I get stuck  is how to get the original script to take those values and replace any unwanted characters found.
    if (!event.willCommit) {
        event.change = event.change.replace(/[\$\#\~\%\*\^\(\)\+\=\[\]\{\}\;\"\<\>\?\|\\\!]/g, "-");
    I just need to put this together correctly and I don't know how.
    I have the form submission part down, that was already done, I just need to add the custom "Run a javascript" item above it so that is executed first.
    Need a little guidance,
    Thanks

  • How to replace special characters in Purchase order item text in ECC 6.0

    Hi All,
    Now i am working in ECC environment.
    I am unable to replace the special characters in the PO short text for example take the following text.
    Job#Burst Fire 3930-00092#Heater Control
    here i want to replace # symbol with space.
    i used  replace all occurences, find , transfer, overlay keywords to replace thta special characte but it is not replacing that character.
    i used replace_string FM also.it is also not working.
    please help me out in this. points will be rewarded.

    Hi Praveena,
    what replacement(s) did you try?
    Please
    replace all occurrences of
    CL_ABAP_CHAR_UTILITIES=>newline
    CL_ABAP_CHAR_UTILITIES=>cr_lf
    CL_ABAP_CHAR_UTILITIES=>form_feed
    CL_ABAP_CHAR_UTILITIES=>horizontal_tab
    CL_ABAP_CHAR_UTILITIES=>vertical_tab
    CL_ABAP_CHAR_UTILITIES=>backspace
    CL_ABAP_CHAR_UTILITIES=>minchar
    CL_ABAP_CHAR_UTILITIES=>maxchar
    minchar is HEX u201900u2018 in non-Unicode systems, U+0000 in Unicode systems
    maxchar is HEX  Xu2018FFu2018 in non-Unicode systems, U+FFFD in Unicode systems
    If it still does not help, check the remaining # characters in debugger, switching to hex mode: Then you may see what it is.
    Regards,
    Clemens

Maybe you are looking for

  • Berkeley DB XML Can't load 32-bit .dll on a 64-bit platform Netbeans

    Hi I am trying to use Berkely DB in netbeans java on 64-bit windows platform. I have downloaded and configured JDK 7 32 bit in project properties. It works well for a simple java project but when i do the same for a web application in netbeans for gl

  • [Solved] Question mark instead of hostname dhcp lease list

    My router running OpenWRT (runs dnsmasq) doesn't always pick up the hostname from one of my Arch pc's. I've recently reinstalled 2 pc's and I always follow the same procedure but sometimes one of them is not showing a hostname in the list. It gets an

  • Import po a/c key

    hi friends which account key is used to post insurance condition condition type zin% and zinv is it fr1 or fr2 in case of import po. fr1 is custom clearing and fr2 is custom provision. points will be rewarded k.chhikara

  • Generating JavaHelp layout off Imported Word doc.

    Hi, I am importing two Word docs (.docx) and generating JavaHelp layout using RoboHelp 9.  It is generating only one .htm file i.e. just one topic for each Word doc.  Is this good for context sensitive help (i.e. Help menu on different GUI will open

  • Linking Contract Master to Work Orders & Materials

    Hello, I'm researching the possibility of linking (tying) stock to a Service Order (in a Work Order) and/or Sales Orders before it arrived on the PO. This is for provisioning stock to customers. Is there any possibility that this could be done via Pr