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
Similar Messages
-
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(',',' '));
} -
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? -
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 -
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 < 1000. This is mentioned in Seller'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 < 1000. This is mentioned in Seller'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 " & " and " < " respectively. The right angle bracket (>) may be represented using the string " > ", and MUST, for compatibility, be escaped using either " > " 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. -
Remove special characters in string
Hi all,
I'm Portuguese, and in our language we use special characters in words like "João or "Sónia".
I need to take off these special characters, which means I want to have the same words like "Joao" and "Sonia", without the characters "~" or "´".
Do you have any idea how can I do this?
Thanks in advance.
Best regards,
Sónia GonçalvesHi,
But I want to make this generic, I don't want to replace character by character.
If I give a string in the program, I want to search all ocurrences of these special characters and replace them.
How can I do this?
Thanks.
Best regards,
Sónia Gonçalves -
Format Special Characters In Strings
Is there a simple way of formatting or automatically escaping special characters in a string?
For example if I have a string that has double quotes in it and I want to escape them, so...
a = "This is a "string" object"becomes...
a = "This is a \"string\" object"public static String escape(String s)
String sOut;
sOut = replace(s, "\\", "\\\\");
sOut = replace(sOut, "'", "\\'");
sOut = replace(sOut, "\"", "\\\"");
sOut = replace(sOut, "\"", """);
sOut = replace(sOut, "'", "'");
sOut = replace(sOut, ">", ">");
sOut = replace(sOut, "<", "<");
sOut = replace(sOut, "�", "£");
sOut = replace(sOut, "�", "¤");
return (sOut);
}Hope this helps -
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 -
Looking for, and replace special characters
Hi
I am quite new to AppleScript and can't figure this out. Any help would be appreciated.
I have received several (a lot of) folders containing images with some strange characters in the file names. The images has to go to web, and I want to replace those characters with some that are web friendly. The characters in question is some Swedish A's and O's (Ä, ä, Ö, ö) and one that looks like the Apple Command symbol. (I was told this one is a combination of a and e).
Then, I would like to replace all spaces between the words in the file names with an underscore.
In addition, all image file names start with capitals and I would like to replace these as well.
Thanks
Neal
G5 Mac OS X (10.4.6)Here's a modified version of the standard script:
try
tell application "Finder" to set the source_folder to (folder of the front window) as alias
on error -- no open folder windows
set the source_folder to path to desktop folder as alias
end try
display dialog "Search and replace in:" buttons {"File Names", "Folder Names", "Both"} default button 3
set the search_parameter to the button returned of the result
repeat
display dialog "Enter text to find in the item names:" default answer "" buttons {"Cancel", "OK"} default button 2
set the search_string to the text returned of the result
if the search_string is not "" then exit repeat
end repeat
repeat
display dialog "Enter replacement text:" default answer "" buttons {"Cancel", "OK"} default button 2
set the replacement_string to the text returned of the result
if the replacement_string contains ":" then
beep
display dialog "A file or folder name cannot contain a colon (:)." buttons {"Cancel", "OK"} default button 2
else if the replacement_string contains "/" then
beep
display dialog "A file or folder name cannot contain a forward slash (/)." buttons {"Cancel", "OK"} default button 2
else
exit repeat
end if
end repeat
display dialog "Replace “" & the search_string & "” with “" & the replacement_string & "” in every item name?" buttons {"Cancel", "OK"} default button 2
tell application "Finder"
set the item_list to every item of entire contents of source_folder
tell me
set item_list to reverse of the item_list
end tell
set source_folder to source_folder as string
repeat with i from 1 to number of items in the item_list
set the_name to name of item i of the item_list
set this_item to item i of the item_list
set this_info to properties of this_item
set the current_name to the_name
set change_flag to false
repeat with this_char from 1 to (count items of search_string)
if the current_name contains item this_char of (search_string) then
if the search_parameter is "Folder Names" and ¬
folder of this_info is true then
set the change_flag to true
else if the search_parameter is "File Names" and ¬
folder of this_info is false then
set the change_flag to true
else if the search_parameter is "Both" then
set the change_flag to true
end if
if the change_flag is true then
set this_item to item i of the item_list
-- replace target string using delimiters
set AppleScript's text item delimiters to the item this_char of search_string
set the textitemlist to every text item of the current_name
set AppleScript's text item delimiters to the item this_char of replacement_string
set the newitemname to the textitemlist as string
set AppleScript's text item delimiters to ""
set the current_name to newitemname
end if
end if
end repeat
my setitem_name(thisitem, current_name)
end repeat
end tell
beep 2
on setitem_name(thisitem, newitemname)
tell application "Finder"
--activate
set the parentcontainerpath to (get the container of this_item) as text
if not (exists item (the parentcontainerpath & newitemname)) then
try
set the name of this_item to newitemname
return this_item
on error the error_message number the error_number
if the error_number is -59 then
set the error_message to "This name contains improper characters, such as a colon (:)."
else --the suggested name is too long
set the error_message to error_message -- "The name is more than 31 characters long."
end if
--beep
tell me to display dialog the error_message default answer newitemname buttons {"Cancel", "Skip", "OK"} default button 3
copy the result as list to {newitemname, button_pressed}
if the button_pressed is "Skip" then return 0
my setitem_name(thisitem, newitemname)
end try
else --the name already exists
--beep
tell me to display dialog "This name is already taken, please rename." default answer newitemname buttons {"Cancel", "Skip", "OK"} default button 3
copy the result as list to {newitemname, button_pressed}
if the button_pressed is "Skip" then return 0
my setitem_name(thisitem, newitemname)
end if
end tell
end setitemname
This script variant works by accepting a source string in the form "AB" and desired string "CD". When run, ABCA will become CDCC with the sample strings.
(19254) -
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. -
Convert HTML special characters to String
Hi,
I'm looking for an easy way to convert HTML special characters (like "ö") to String.
Any Ideas how implement this? ThanksHi,
I'm looking for an easy way to convert HTML special
characters (like "�") to String.
Any Ideas how implement this? Thankswell im assuming that you mean that when you are working with java you will be getting a ? instead of the character you want. assuming that you are reading and writing to this html file. if not well maybe this can stil help : BufferedReader inFile = new BufferedReader(new InputStreamReader(new FileInputStream(fileName),"ISO8859-1"));
PrintWriter outFile = new PrintWriter(new OutputStreamWriter(new FileOutputStream(fileName2), "ISO8859-1")); basically you need to make sure that ou define ISO8859-1 as the encoding. -
Hi,
I want to rename files containg special characters in a directory tree.
For example I want
06\ --\ Doppelgänger.flac
renamed to
06\ --\ Doppelganger.flac
I have found a python script that seems to be able to do it here.
I have also found a list of replacements characters
my $AccentedChars = '€–‚ƒ„…†‡ˆ‰Š‹Œ–Ž––''""•–—˜™š›œ–žŸ'.
'–¡¢£¤¥¦§¨©ª«¬-®¯°±²³´µ¶·¸¹º»¼½¾¿'.
'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß'.
'àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ';
my $NonAccenChars = 'E-,f,.++^%S_O-Z--````.--~Ts_o-zY'.
'-!cLoYlS`Ca_--R-`+23`uP.,10_qh3_'.
'AAAAAAACEEEEIIIIDNOOOOOxOUUUUYTS'.
'aaaaaaaceeeeiiiidnooooo%ouuuuyty';
from this perl script (which throws an error when used. Otherwise it would be perfect).
So, can somebody tell me how I could feed the python script with the above replacement table?
I have tried but I can't seem to get it to work.
I have also tried to make a simple bash-script using rename but I could not that to work either.
I would really appreciate any help.
Thanks,
RasmusI didn't try the perl script, but sed's y command will do exactly this. tr complains about a dash
accent='€–‚ƒ„…†‡ˆ‰Š‹Œ–Ž––''""•–—˜™š›œ–žŸ–¡¢£¤¥¦§¨©ª«¬-®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'
nonaccent='E-,f,.++^%S_O-Z--````.--~Ts_o-zY-!cLoYlS`Ca_--R-`+23`uP.,10_qh3_AAAAAAACEEEEIIIIDNOOOOOxOUUUUYTSaaaaaaaceeeeiiiidnooooo%ouuuuyty'
echo '06\ --\ Doppelgänger.flac' | sed "y/$accent/$nonaccent/"
So you could do something like
for file in *; do
mv -v -i -- "$file" "$(echo "$file" | sed "y/$accent/$nonaccent/")"
done -
Search & Replace special characters?
Is there a way to search & replace for special characters, such as paragraph or tab marks?
Not in Pages 5.2 because Apple made it new and improved.
However both Pages '08 and Pages '09 can search on invisible characters, precisely because they are not new and improved.
Peter
Maybe you are looking for
-
Help...How to I get files from my external hard drive into my Library!
I ran out of space on my PC's hard drive, so I bought an external drive, and copied everything over there. I deleted the files on my PC's hard drive, and changed the setting in iTunes to look for files on the external drive. The trouble is, there are
-
Displaying current month in prompt
Hi, I want to show the current month as the default value in Prompt in XI R3.1 Webi. i.e. when the user runs the report, the prompt for "Month" should show the current month (Say March) and if user wants to change it he can change it to someother mon
-
Foreign JMS QCF and Weblogic Sever Session Pool
Hi! We have Weblogic 6.1 SP2 installation. We are trying to use JMS Server session pool and connection consumer configuration with MQSeries QCF registered to weblogic JNDI via startup class. Upon serv
-
Point and click quiz not rendering properly
Hi I have created a point and click quiz in Captivate. The problem I'm having is that after a few slides, the screen breaks up and does not render correctly, meaning that my click box targets are in the wrong place. Would anyone kow why this is happ
-
How to unlock my sap user account sapuser..plz help me out
Hello, I am a newbie to sap bw.I am practising sap bw with sap r/3.My user login account got locked becoz of password error.Now i know the correct password for the user sapuser.please advice me how can i relogin to my my sap bw. "It s