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(',',' '));
}

Similar Messages

  • Replace special characters in String

    Dear Guru ,
    Does SAP provide the standard function that can replace the special characters in String ?
    For example :
    I have one template string : " & & & & & output(s) have not been processed yet ! " and five parameters : "P1" , "P2" , "P3" , "P4" , "P5" .
    And i would like to apply all parameters into the string to replace the "&" character . Is it possibile ?
    My idea is sourcing from the Message String that in tcode : SE91 .
    Thanks .
    Best Regards,
    Carlos Zhang

    Hi Carlos,
    I think instead of a standard FM you can write a one line command to do this job.
    E.g. 
    constant: str1 type string value 'output(s) have not been processed yet ! '.
    data: var1 type c,
             var2 type c,
             var3 type c,
             var4 type c,
             str    type string.
    concatenate var1 var2 var3 var4 str1 into str separated by space.
    So str will have the final value.
    Thanks,
    Mainak

  • How to Avoid Special Characters in string

    Hai.
    I want only Alphabets & Digits to be entered in to my string.No any other special characters except spaces.How can I do this? 
    Solved!
    Go to Solution.

    MikeS81 wrote:
    see the attached example.
    I would allow a few more, e.g. 0 and 8 to allow editing of the entered string (backspace, cursor buttons, delete key, etc.).
    Message Edited by altenbach on 11-21-2008 12:49 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    check_char_LV80MOD.vi ‏14 KB
    FilterStringInput.gif ‏6 KB

  • 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

  • How to replace special characters with html code characters automatically?

    A colleague and I work on these html pages. They eventually end up as emails, but we have the cold fusion server to pre process them. One thing we are trying to do is eliminate problems caused by unencoded copyright, trademark and smart quote symbols.
    How could I create an array of find / replace commands in the header so it processes the HTML with correct character codes.
    I"m not cold fusion aware, so any kind of starter info would be great. Eventually I might add more replacements to the array.
    As an example TM (font character) would process to ™ and a smart quote or apostrophe would process to a straight one. an en dash character would become –
    Because we copy paste from places, this often happens and it seems like cold fusion could solve the problem quickly and repeatedly all at once.
    thanks for any help
    -smick

    CF has a built in HTMLEditFormat function for handling <  &  > characters.  For handling trademark and smart quote characters you might try searching for a user defined function at http://cflib.org or writing a user defined function yourself that will handle the specific characters needed in your application.

  • How to remove special characters while typing data in edit cell in datagrid in flex4

    Hi Friends,
    I am facing this problem "how to remove special characters while typing data in edit cell in datagrid in flex4".If know anyone please help in this
    Thanks,
    Anderson.

    Removes any characters from
    @myString that do not meet the
    provided criteria.
    CREATE FUNCTION dbo.GetCharacters(@myString varchar(500), @validChars varchar(100))
    RETURNS varchar(500) AS
    BEGIN
    While @myString like '%[^' + @validChars + ']%'
    Select @myString = replace(@myString,substring(@myString,patindex('%[^' + @validChars + ']%',@myString),1),'')
    Return @myString
    END
    Go
    Declare @testStr varchar(1000),
    @i int
    Set @i = 1
    while @i < 255
    Select
    @TestStr = isnull(@TestStr,'') + isnull(char(@i),''),
    @i = @i + 1
    Select @TestStr
    Select dbo.GetCharacters(@TestStr,'a-z')
    Select dbo.GetCharacters(@TestStr,'0-9')
    Select dbo.GetCharacters(@TestStr,'0-9a-z')
    Select dbo.GetCharacters(@TestStr,'02468bferlki')
    perfect soluction

  • How to print Special Characters in Sap-Scripts

    How to print Special Characters in Sap-Scripts
    Thanks,
    Ravi

    Hi
    if u want print special characters we can use hot codes i.e '  '  (single inverted commas). in between these hot codes insert u r special characters.
    write    '    !@#$%^&*( )  '.
    for the above write statement output is
    output is   !@#$%^&*( )

  • How to write special characters in PDF using iText

    How to write special characters encoded with UTF-8 in PDF using iText.
    Regards,
    Pandharinath.

    I don't know what your problem is but that's almost certainly the wrong question to ask about it. Java (including iText) uses only Unicode characters. (You may consider some of them to be "special" if you like but Unicode doesn't.) And when it does that, they aren't encoded in UTF-8 or any other encoding.
    So can you describe your problem? That question doesn't make sense.

  • How to display special characters in Script...

    hi all,
    Can any one tell me how to display special characters in script...
    how to write in text element
    thanks in advance,
    prashant

    Hi Prashant ,
      What special characters would you like to include .
    There are a set of characters / icons /symbols that can be included in Script , for that open a window in edit mode and in the menu there will be an option called Insert  , here you can find a lot of characters/symbols that can be included .
    Regards,
    Arun

  • 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]

  • 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?

  • Regular expressions-how to replace [ and ] characters from a string

    Hi,
    my input String is "sdf938 [98033]". Now from this given string, i would like to replace the characters occurring within square brackets to empty string, including the square brackets too.
    my output String needs to be "sdf938" in this case.. How should I do it using regular expressions? I tried several possible combinations but didn't get the expected results.

    "\\s*\\[[^\\]]+\\]"

  • 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

  • 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

  • How to convert special characters like #, &, etc occuring in the input string

    Hi,
              I am using method 'Get' to submit a form . When ever there is any
              special character like '#' in my input For example "033#Test", nothing
              gets posted beyond 033.
              Can any one please let me know how do I overcome this problem.
              Thanks in advance.
              Regards,
              Moin
              

    Moinuddin:
              It seems possible your browser may be confused by the fact that 033 is
              the octal representation for an ESCape character (Hex 1B). Try dropping
              the leading zero. In addition, it is usually better to represent special
              characters like the hash mark "#" using HTML character entities instead
              of literals, i.e. &#35; = hash mark
              Regards,
              Jim Brown
              Moinuddin Ahmed wrote:
              >
              > Hi,
              > I am using method 'Get' to submit a form . When ever there is any
              > special character like '#' in my input For example "033#Test", nothing
              > gets posted beyond 033.
              >
              > Can any one please let me know how do I overcome this problem.
              >
              > Thanks in advance.
              > Regards,
              > Moin
              Jim Brown
              Developer Relations Engineer
              BEA Support
              

Maybe you are looking for

  • How do I install a second USB-8451using an alias in our VI's?

    I am trying to write VI's that use USB-8451 aliases, set up in the MAX utility.  I save the alias name as "USB-8451".  This usually works, but when I try to use another USB-8451 I use the following procedure: To change NI 8451 unit out: 1:  Goto C:\v

  • Changing database to noarchivelog mode during impdp

    Hi Guys, I am using Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production on RHEL5. I am in the middle on the impdp and I want my database to run on noarchivelog as it creates a lot of archivelogs. Will it be proper if I stop t

  • Netweaver  XI Integration between different servers

    We are planning to conect the network between Client/Server which is java based system to SAP XI.      and Mainframes to sap XI. Can you please let me know how to Integrate between them ?

  • Migration Assistant can't see old computer

    I just got a new MBP running Snow Leopard 10.6.3. I want to transfer the contents of my old computer, a Power Book G4 running 10.5.8. I have them connected with a Belkin Firewire 800/800 9 pin to 9 pin cable. When I launch the MA on the MBP, I get to

  • Using an Analogue mixing desk with garageband?

    Hi guys, As you can tell i'm really not a techie! I'm looking to use a mixing desk with garageband, it's analogue and i have the new macbook pro retina, but I don't know how i could connect it to my mac. I need it for recording demos, but firstly wil