How to remove extra Characters in a string
Hi,
I have created a variable , that basically converts all the data from separate rows in one cell , but for some resons i am getting alot of commas between different values , for example
Var_ Max concatnate 8
208016,,,,,207736,,,,,,205796,,,204476,204441,203521,111460,111382,110812,110504,110483,109908,,,101284,
but i want to show like
i just want 1 "," after every value , and deleting the last "," as well , like where every is more than 1 "," show just one "," and also dont show the coma after the last value
so basically these are different values coming in on cell
any logic of using SubString which can be used ?
actually its coming as following
Var_Ctegory 8
,208016,,,,,207736,,,,,,205796,,,204476,204441,203521,111460,111382,110812,110504,110483,109908,,,101284,
Similar Messages
-
Removing Duplicate Characters in a String without using a Hashset
I was wondering if anyone knew a way of removing duplicate characters in a string without using a Hashset.
I want to go from
helloworld -> helowrdokay, here it is
1) use a loop, look through each character in the original string
2) look at the new string, if this character exist, don't add it, otherwise add it.
check out methods in java.lang.String -
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 remove extra spaces in a xml formatted string
Hi,
I am trying to remove extra spaces between the xml tags. For
example, if a string is something like
' <header 1> <header 2> test </header 2> </header1>'
I want to get rid of the spaces only between the closing tag of header 1 and opening tag of header 2 and closing tag of header 2 and opening tag of header 1, in short ,I want to remove the extra spaces between the tags if there are no other characters between them. I do not want the remove the spaces between closing tag header 2 and opening tag of header ,as there is occurence of other characters.
I am aware that this can be done by looping through the string and using instr to identify the characters '<' and '>', but I would like to use it as a last resort only.
Can anyone suggest me a better way of doing it in a single go by manipulating the data?
Any help is really appreciated.
Regards,
Anil.You can use the replace function. If you only expect one extra space, then:
scott@ORA92> select replace ('<header 1> <header 2> test </header 2> </header1>',
2 '><', '><')
3 from dual
4 /
REPLACE('<HEADER1><HEADER2>TEST</HEADER2></HEADER
<header 1> <header 2> test </header 2> </header1>
If you expect more extra spaces, then you will need to wrap another replace function around it for each space, for example the following will eliminate up to three spaces:
scott@ORA92> select replace (replace (replace ('<header 1> <header 2> test </header 2> </header1>',
2 '> <', '><'), '> <', '><'), '> <', '><')
3 from dual
4 /
REPLACE(REPLACE(REPLACE('<HEADER1><HEADER2>TEST
<header 1><header 2> test </header 2></header1> -
How to remove the characters from first and last position of a string?
Hi all,
I am creating an application where i am using vb script to export the data to excel.
In the excel sheet most of the values are entered with double " quotes.
so the entry looks like ""http://www.sap.com"".
Notice that it is starting with "" and not " . so the vb takes it as a line feed and shows an error .
It will be great if anybody can tell me how to remove these set of quotes ,so that the value should come as "http://www.sap.com" . A sample code wil be of great help.
Thanks in advance,
mahima.Hi,
To modify you excel you have 2 options, 1) you can filter them in excel itself by using filter ...etc in excel itself. or 2) you can do it by using ABAP code.
Below code may help you.
Get the data from Excel to Internal table using FM :
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = 'c:\temp\test.xls'
i_begin_col = 1
i_begin_row = 1
i_end_col = w_values
i_end_row = 10
tables
intern = t_alsmex_tabline
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
Now replace all unwanted "" in internal table with space.
replace all occurrences of '""' in itab-field with ' '.
Again you can export to Excel using
call function 'GUI_DOWNLOAD'
exporting
filename = lv_file
filetype = 'DAT'
append = ' '
write_field_separator = 'X'
tables
data_tab = itab. -
How do you removing special characters from a string
hi,
i'm a novice to java, if you couldn't tell. i need to write a program to recognise palindromes (eg. madam etc.) but i can't work out how to strip or clean the input string of white space or punctuation. any help appreciated. by the way, any other ideas on how to go about it?? (i don't expect it to be done, just after guidance)
my thanks in advanceOK Here you are:
protected static String removeJunk(String string)
int i, len = string.length();
StringBuffer dest = new StringBuffer(len);
char c;
for (i = (len - 1); i >= 0; i--)
c = string.charAt(i);
if (Character.isLetterOrDigit(c))
dest.append(c);
return dest.toString();
Klint -
How to remove special characters in xml
Dear friends,
How to remove the special character from the xml. I am placing the xml file and fetching through file adapter.
The problem is when there is any special character in xml. i am not able to pass to target system smoothly.
Customer asking schedule the file adapter in order to do that the source xml should not have any special charatcters
How to acheive this friends,
Thanx in advance.
Take careHi Karthik,
Go throgh the following links how to handle special character
https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9420 [original link is broken] [original link is broken] [original link is broken]
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42
Restricting special characters in XML within XI..
Regards
Goli Sridhar -
How to remove extra html markups from adf generated code in webcenter porta
hi!
I am trying to develop navigation in oracle webcenter portal.
My code is generating extra div's for li and a tags. how to remove the extra div's.
code in my template for generating navigation is:
<div id="JS-MainNav " class="menu9 clearfix">
<ul class="jd-menu">
<!-- Root UL-->
<c:forEach var="node" varStatus="vs"
items="#{navigationContext.currentModel.listModel['startNode=/, includeStartNode=false']}">
<li class="single">
<!-- first li-->
<af:goLink id="gLink" styleClass="menu9two accessible"
destination="#{node.goLinkPrettyUrl}">
<af:outputText value="#{node.title}"/>
</af:goLink>
</li>
<c:if test="${node.selected}">
<c:set value="${node.children}" var="childNodes"
scope="session" />
<ul>
<!-- 2nd level ul inside li-->
<c:if test="${childNodes ne null}">
<c:set var="childNodes"
value="${navigationContext.currentModel.currentSelection.parent.children}"/>
<c:forEach items="#{childNodes}" var="node">
<li class="fixMenuEN ${node.selected ? 'active' : ''}">
<!-- 2nd level li-->
<af:goLink inlineStyle="#{node.selected ? 'font-weight:bold;' : ''}"
id="sub" text="#{node.title}"
destination="#{node.goLinkPrettyUrl}"/>
</li>
</c:forEach>
</c:if>
</ul>
<!--</c:set>-->
</c:if>
</c:forEach>
</ul>
</div>
<!-- xMain Site Tabs -->What's the HTML result in your browser form this code?
-
How to remove HTML tags from a String ?
Hello,
How can I remove all HTML Tags from a String ?
Would you please to give me a simple example ?
Best regards,
EricHere's some code I cooked up. I have created an object that processes code so that it can be incorporated directly into a project. There is some redundancy so that the it can be used in more than one way. Depending on your situation you might have to make the condition statement a little more sophisticated to catch stray ">" tags.
I have also included a Tester application.
//This removes Html tags from a String either by submitting the String during construction and then
// calling getProcessedString() or
// by simply calling " stringwithoutTags=removeHtmlTags(stringWithTagsSubmission); "
//Note: This code assumes that all"<" tags are accompanied by a ">" tag in the proper order.
public class HtmlTagRemover
private String stringSubmission,processedString,stringBeingProcessed;
private int indexOfTagStart,indexOfTagEnd;
public HtmlTagRemover()
public HtmlTagRemover(String s)
removeHtmlTags(s);
public String removeHtmlTags(String s)
stringSubmission=s;
stringBeingProcessed=stringSubmission;
removeNextTag();
return processedString;
private void removeNextTag()
checkForNextTag();
while((!(indexOfTagStart==-1||indexOfTagEnd==-1))&<indexOfTagEnd)
removeTag();
checkForNextTag();
processedString=stringBeingProcessed;
private void checkForNextTag()
indexOfTagStart=stringBeingProcessed.indexOf("<");
indexOfTagEnd=stringBeingProcessed.indexOf(">");
private void removeTag()
StringBuffer sb=new StringBuffer("");
sb.append(stringBeingProcessed);
sb.delete(indexOfTagStart,indexOfTagEnd+1);
stringBeingProcessed=sb.toString();
public String getProcessedString()
return processedString;
public String getLastStringSubmission()
return stringSubmission;
public class HtmlRemovalTester
static void main(String[] args)
String output;
HtmlTagRemover h=new HtmlTagRemover();
output="The processed String: "+h.removeHtmlTags("<Html tag>This is a test<another Html tag> string<yet another Html tag>.");
output=output+"\n"+" The original string:"+h.getLastStringSubmission();
System.out.print(output); -
How to remove extra spaces from Data Matrix Label?
Hi All,
Kindly let me know how we can remove extra spaces from Data Matrix Label.
Suppose we have this following code in SO10.
^FO1380,1879^COY,78^BY4^BXR,6,200^FH^FD[)>_1E06_1DF01001T_1D6JUN&v_huf&&v_hul&_1DV&v_supnum1&_1D16K&v_del&_1D6D&v_flddat1&095_1D2L&v_unload&_1D
P&v_article&_1D4L&v_madein&_1D_1E_04^FS.
Variable have there own value. and the desired result will be shown like the attachment.
But in my code it splits into new line when CMIR value has 3 spaces.
If CMIR value is 1S0 820 355 A . then it creats a new line.
Kindly suggest me any possible solution.
Thanks,
ParthaHi Gaurav,
In print preview we can't see any space or new line. But when it scanned by TSB (barcode scanner) it will generate a new line when there is 3 space CMIR value.
So where should I write SHIFT CMIR LEFT DELETING LEADING space this code?
Because there is no space coming at the time of debugging or print preview.
And in SO10 the code written as
^FO1380,1879^BY4^BXR,6,200^FH^FD[)>
Here CMIR value is 1SO 820 303 A
and generated output is like this.
And desired output should be like this. -
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
DanaHTH
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 -
How to remove the characters last position of a string?
HI
I am creating a program in which i want to remove last 4 chars of char string.
Ex: Source data XXXXXXYYYY or XXXXXYYYY
Target data XXXXXX or XXXX .
Irrespective to length of char i want to remove last 4 chars...
Whats the command i could use
Thanks in advanceHi,
please check this test report:
REPORT zstrlen.
PARAMETERS: xp_str TYPE string OBLIGATORY DEFAULT 'XXXXXYYYY' LOWER CASE.
DATA: xv_string TYPE string.
DATA: xv_length TYPE syindex.
START-OF-SELECTION.
xv_length = STRLEN( xp_str ).
IF xv_length GT 4.
xv_length = xv_length - 4.
ELSE.
xv_length = 0.
ENDIF.
IF xv_length = 0.
xv_string = ''.
ELSE.
MOVE xp_str(xv_length) TO xv_string.
ENDIF.
WRITE: /1 'Input :', xp_str,
/1 'Output:', xv_string.
Regards,
Klaus -
How to remove special characters in a particular column
Hello,
i have a csv feed and i load it into a sql table (the sql table has all varchar data type fields)
feed data looks like (just sampled 2 rows but my file has thousands of like this)
"K" "AIF" "AMERICAN IND FORCE" "FRI" "EXAMP" "133" "DISPLAY" "505250" "MEDIA INC." 03/01/10" "INV31202" ".00" ".00" "0.00" "ALLO" ;
"K" "AIF" "AMERICAN IND FORCE" "THU" "TRTH" "123" "MUN MARCH 2010" "505099" "SOCIALTYZE" "03/01/10" "1308" "40,282.32" "40,282.32" "45564.64" "DIS" ;
some times i got some special characters in my table column (example: in my invoice no column some time i do have # or ! kind of invalid characters ) so how can i remove some kind of special characters in my column
once it is eliminated then i can write it to new table (with correct data format such as integer)
could some one please tell me how can i remove special character in a column of particular table
thanks in advance
asitaRemoves 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 remove extra blank spaces from log file.
i have created a log file which contain the logs of a program. the logs are getting created fine for the first execution of the program but from the second time the log file is getting blank space's after every character.
i have used the code to append the text in log files few examples :
'Clean up process started....' >> $log
File name :'+ $files +'Time-Stamp: '+ $endtime +'Search complete.' >> $log
.i want to remove the extra spaces after each character but not all the spaces from the file. Thanks in advance.hi mjolinor
add-content is used to insert text it does not append text at the file .i used >> to append the text on log file ..
from
Get-Help ADd-Content
Synopsis
Appends content, such as words or data, to a file.
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " " -
How to remove extra char in the uploaded file...?
Dear All,
There is file upload page in our portal.When user uploads the file (CSV) i can see there is extra char (^M) in the unix env.How can I remove that extra char before inserting into the database.For inserting into database I am using below code:
BlobDomain blobdomain = (BlobDomain)pageContext.getParameterObject(upldFileNameHD);
header.setFileData(blobdomain);
Did anyone can help me on this...
ThanksRaffy is right in giving the explanation on why this happens.
Now way to
1. Remove it:
A. open file in vi
B. use this command, the way it works is, search(%s) for the ^M char and replace it with space (//) , and do this globally (g)
:%s/^M//g
C. To type ^M char press Ctrl Key and press either M or J, it should print that char.
D. Save the file (:wq)
2. Avoid it:
when doing FTP, use binary mode, just type bin before you do a put.
Thanks,
Tapash
Maybe you are looking for
-
9.2.0.6 to 9.2.0.8
Dear all, How can I Upgrade my DB from 9.2.0.6 to 9.2.0.8.. am trying to download the patch from metalink.. but could'nt find any valuable downloads.. Any idea ? Yusuf
-
Nokia 6233 - screen awakes from Power Save / Sleep...
I have Power Save and Sleep Mode on, but ScreenSaver off. However, the screen often awakes from PowerSave / Sleep (not sure which - manual doesn't describe the difference) and lights up. This is especially annoying when driving and the Nokia is on a
-
When I installed a trial version of LR 5 it seemed to be copying my catalog from my LR 4.4, but now all my catalog and collections have disappeared from LR4 and are not in LR 5 either. How do I get my catalog and collections back?
-
How to show Titles in browser?
I have seen at one PC Titles area but one PC is not shown. Is this preferences issue?
-
Print delivery note with VL01N
Hi, The delivery note prints only when I post the good issue. But I would like to print it automatically when I use the VL01N I delete the routine "1" in NACE for my condition type LD00 (If goods issue has been posted for the delivery, then the out