Replace last comma with ' and '
Hi All,
please let me know is there any simple way of replacing last comma in as string with ' and '
eg: 1. abc,xyz,wuv should be returned abc,xyz and wuv
2. abc,wuv should be returned abc and wuv
3. abc,pqr,cuq,wuv should be returned abc ,pqr,cuq and wuv
DB version : 11.2.0.3
Thanks,
DS
With only SUBSTR and INSTR:
<LQS with sample_data as ( select 'abc,xyz,wuv' str from dual union
2 select 'abc,wuv' from dual union
3 select 'abc,pqr,cuq,wuv' from dual
4 )
5 --
6 -- actual query
7 --
8 select str
9 , substr(str, 1, instr(str, ',', -1)-1)||' and '||substr(str, instr(str, ',', -1)+1)
10 from sample_data;
STR SUBSTR(STR,1,INSTR(STR,',',-1)-1)||
abc,pqr,cuq,wuv abc,pqr,cuq and wuv
abc,wuv abc and wuv
abc,xyz,wuv abc,xyz and wuv
3 rows selected.
Similar Messages
-
Replace last delimeter with "and" in a string in SSRS
Hi,
I want to replace last delimeter (comma) with and
in a string in SSRS 2008 R2.
if there are more than one unit, and the Area of the units are different, then the area of each must must be listed separated by commas and ‘and’ before the last one.
i.e.,
Input string- Hi,Hello,HRU,
Desired output- Hi,Hello and
HRU..
how can I achieve this (and
before last word) ?
(suggest in SSRS or even in SQL)
Rgds/-Your example seems to indicate you wish to substitute "and" for the second to last delimiter and ".." for the last. Is that the ask? Will there actually be a trailing delimiter on the input string?
This can be done several ways: In the dataset, in an expression, using custom code.
The approach for the dataset and expression are similar, just the language is different. Dataset will usually deliver better performance since the source is often a more powerful server (in the case of a SQL dataset).
In an SSRS expression it might look like this:
=Left(Fields!InputString.Value,InStrRev(Fields!InputString.Value,",")-1)+" and "+Right(Fields!InputString.Value,Len(Fields!InputString.Value)-InStrRev(Fields!InputString.Value,","))
This assumes the input string is actually a field from your dataset but it could be anything. The Left piece gets the string that occurs before the last comma without the comma, then append " and ", then the Right expression gets everything after the last
comma and appends it. If you will have a trailing delimiter, you could substitute the following formula anywhere you see Fields!InputString.Value:
=Replace(Trim(Replace(Fields!InputString.Value,","," "))," ",",")
Because Trim in an SSRS expression only trims leading and trailing spaces, the delimiters must be converted to a space. So this only works if there are no spaces in the original string. If the input is "Hi,Hello,How are you," the result of this formula will
be "Hi,Hello,How,are,you" because the spaces between How, are and you will get replaced by ",". To handle embedded spaces makes the expression more complex. Assuming the input string is "Hi,Hello,How are you,":
=Replace(Replace(Trim(Replace(Replace(Fields!InputString.Value," ","|"),","," "))," ",","),"|"," ")
This expression uses 2 more replace statements. The innermost statement substitues "|" for the embedded spaces so they don't get replace with ",". You should use a character that you are sure will not appear in the string otherwise. Or use a sequence of
characters like "|^|" that you are sure won't appear if any one character may possibly appear. The outermost Replace restores the "|" characters back to spaces.
A code solution may be easier. Just wrap the below in a simple function:
return str.Trim(",".ToCharArray()).Substring(0, str.Trim(",".ToCharArray()).LastIndexOf(",") - 1) + " and " + str.Trim(",".ToCharArray()).Substring(str.Trim(",".ToCharArray()).LastIndexOf(",") + 1);
This is the VB.Net equivalent of the expressions above.
"You will find a fortune, though it will not be the one you seek." -
Blind Seer, O Brother Where Art Thou
Please Mark posts as answers or helpful so that others may find the fortune they seek. -
Calculated formula for replacing a comma with a Semicolon in a text field
I need help replacing a comma with a Semicolon in a text field.
I have a field that has names separated by commas.
Ex: Dog, Cat, Bird, Horse, Eagle, Worm, Snake
I would like a calculated column that converts the field into: Dog; Cat; Bird; Horse; Eagle; Worm; Snake
I figured out the first three positions (Dog, Cat, Bird,) but I can't figure out the rest.
Using the formula below.
=REPLACE((REPLACE((REPLACE([Title],SEARCH(",",[Title]),"1"," ; ")),SEARCH(",",(REPLACE([Title],SEARCH(",",[Title]),"1"," ; "))),"1"," ; ")),SEARCH(",",(REPLACE((REPLACE([Title],SEARCH(",",[Title]),"1","
; ")),SEARCH(",",(REPLACE([Title],SEARCH(",",[Title]),"1"," ; "))),"1"," ; "))),"1"," ; ")
Please helpcheck the similar post
http://social.technet.microsoft.com/Forums/windowsserver/en-US/66e2ae2a-4da9-4c58-a8bb-cf46b1bf448f/calculated-column-to-replace-commas?forum=sharepointgenerallegacy -
Replacing csv commas with tabs
Has anyone come accross a command, preferably in vi to replace comma's seperated fields with tab delimited fields? I know about the substitution command but as people who work with csv files might know that fields of data with commas in them have quotation marks around them, I need to keep these commas in the file.
Not sure if I understand this 100%
But if I do, then this should work:
`fixcsv.py inputfile outputfile`
Things that are quoted because they contain a comma will no longer be quoted since thats no longer the delimiter (tab is). Also, you can uncomment the commented out line to have every field surrounded in quotes.
#!/usr/bin/python
#fixcsv.py
import csv
import sys
reader = csv.reader(open(sys.argv[1], "rb"))
writer = csv.writer(open(sys.argv[2], "wb"), delimiter='\t')
#uncomment next line if you want everything quoted
#writer = csv.writer(open(sys.argv[2], "wb"), delimiter='\t', quoting=csv.QUOTE_ALL)
writer.writerows(reader)
Be sure to backup your data just in case.
Last edited by sabooky (2007-06-06 05:00:14) -
Replacing audio track with and synching with separate recording
Hello,
I've read everything I can find, including numerous websites, the help file, and a book, but can't find this answer with step by step instructions using Premiere Elements 9.
I have the trial version, and will purchase once I figure this out. I only need to make Youtube videos with a separately recorded audio file replacing the audio that is already on the video. in other words, I have a separate Mp3 audio file of the same audio performance using an audio recorder and I want to replace the audio on the original video with the other Mp3.
What are the steps involved to make sure the new audio is in synch with the audio already on the video, beginning with the original recordings and working through to the finished product?
Thank you.Hunt, I hope I didn't seem dismissive of Steve's book - I did think it was very good and am glad I purchased it. I just wasn't able to figure out the answer based on what was in it.
I did not take your comment as dismissive in any way, and highly doubt that Steve did either. I do not have his newer version book, but only some older ones, or I would have grabbed it and checked to see if he DID cover this material in it, just maybe buried in another topic. My comments were pure speculation, as what you are doing is not "mainstream," though is becoming more so monthly.
For my PrPro (slightly older version), I have the printed manual (yes, they used to do those), the Adobe Classroom in a Book, plus several other volumes dedicated to it, and even the print-out of the Help File PDF. Still, I, and other users are always coming up with some use, that is not covered anywhere!
One of the recent changes to the Help File in many Adobe programs, is that it is now a live On-line document, and there are engineers, who do little but update and add to that. This was almost impossible with printed material (though I still have my old ring-binder for the original WordPerfect, and monthly, they used to send me new pages to either add, or replace - long time ago).
When I am working in the forums, I usually have the particular program open and in front of me, as I am always coming up against questions, thinking, "wow, I would never have thought of doing that," and having to duplicate the actions that a poster outlines, or experimenting to find if what they want is possible. Often, when I do one of the experiments successfully, I'll add an article on doing it, to the Tips & Tricks sub-forum here. One example of that was "Fading a Title Crawl," which turned out to be both fun, and relatively easy, when I got into the experiments.
I have a stong feeling that Steve will have a bit more "music video" instruction in his next PrE book, as it is becoming more popular, as evidenced by the number of posts that we are seeing lately. More folk are doing that. Same thing for shooting with what were considered non-standard cameras, just a few years ago, like various smartphones.
Good luck, and happy editing,
Hunt -
Replacing a comma with a paragraph mark
Hello All,
I have some poor quality address information which is in the form:
<ADDRESS>1 High Street, Kensington, London, England, SW1<!ADDRESS>
and on the letter I need to convert it into:
1 High Street
Kensington
London
England
SW1
Any clues how to do this conversion?
Help appreciated.
Regards
RichardIf the fields remain constant, then you know how many commas are present. Given that, you can instring and substring the entire string based on the commas.
You can test this out in SQL using a table.
create table bip (address varchar2(60));
insert into bip values
('1 High Street, Kensington, London, England, SW1');
In SQL*Plus:
col a for a13
col b for a12
col c for a12
col d for a12
col e for a12
--this will show each part of the address, but all on one line
select
--first part
substr(address,1, instr(address,',',1,1)-1) "A",
--second part
substr(address, instr(address,',',1,1)+2, instr(address,',',1,2)-instr(address,',',1,1)-2) "B",
--third part
substr(address, instr(address,',',1,2)+2, instr(address,',',1,3)-instr(address,',',1,2)-2) "C",
--fourth part
substr(address, instr(address,',',1,3)+2, instr(address,',',1,4)-instr(address,',',1,3)-2) "D",
--fifth part
substr(address, instr(address,',',1,4)+2) "E"
from bip;
A B C D E
1 High Street Kensington London England SW1
--this will line return after each part of the address
select
--first part
substr(address,1, instr(address,',',1,1)-1) ||chr(10)||
--second part
substr(address, instr(address,',',1,1)+2, instr(address,',',1,2)-instr(address,',',1,1)-2) ||chr(10)||
--third part
substr(address, instr(address,',',1,2)+2, instr(address,',',1,3)-instr(address,',',1,2)-2) ||chr(10)||
--fourth part
substr(address, instr(address,',',1,3)+2, instr(address,',',1,4)-instr(address,',',1,3)-2) ||chr(10)||
--fifth part
substr(address, instr(address,',',1,4)+2) "ADDRESS"
from bip;
ADDRESS
1 High Street
Kensington
London
England
SW1
What you do in Desktop (xpath query) is to write the select part for each element. -
REPLACEMENT OF COMMA WITH FULLSTOP
HI ALL,
I AM WORKING ON AN ISSUE WHERE I AM FACING A PROBLEM OF COMMA AND FULL STOP.I MEAN THE VALUES SAY NET VAL IS GETTING PRINTED LIKE <b>2.500,45</b> INSTEAD THE VALUE SHOULD BE <b>2,500.45</b> ,AND I NEED A SUGGESTION FOR THIS ISSUE.AND I HAVE EVEN CHECKED IN SETTINGS IT IS PROPER.DO WE HAVE ANY SUCH FUNCTION MODULE.
THANKS AND REGARDSHi,
U can use the statement
SET COUNTRY f.
Displays the decimal point in subsequentoutput (WRITE) according to the settings specified in the tableT005X for the country ID f.
IN ur case use the following :
SET COUNTRY 'DE'.
If u change the settings, in User profile, then it will be effective only for that user, but its not sure that i.e only user who will exceute, there might be any number of users who will exceute that. So it should not be user dependent.
Revert back if any issues,
reward if helpful.
regards,
naveen
Message was edited by:
Naveen Deva -
XSLT mapping not working b'coz " " & " " replaced with and
Hello Experts,
I have a RFC to JMS scenario. One of the parameter of RFC is a string field. This field will contain the XML data in it.
I need to create a complete XML payload using this data in a string field. For this I am using XSLT map :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" omit-xml-declaration="no"/>
<xsl:template match="/">
<xsl:for-each select="//Nem">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
This XSLT mapping works fine when tested independently.
But in actual scenario at runtime the "<" & ">" used to indicate a node are getting replaced with < and >. Then the XSLT mapping fails and produces no output.
The output of XSL will be passed in to a java mapping which signs the payload digitally.
What is the issue with these signs? How can I overcome this problem?
Any inputs will be of great help.
Kind Regards,
Abhijeet.
Edited by: Abhijeet Ambekar on May 4, 2010 2:01 PMHi Stefan,
Yes - I want to get rid of & # 60. But these (& # 60 and & # 62) are not added by XSLT mapping. Rather they are in the input available to XSLT map.
In sxmb_moni, i can see the inbound payload correctly :
<?xml version="1.0" encoding="UTF-8" ?>
- <rfc:HDK083_REFUS_SENDDOCU xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
<P_SIGN_DOCUMENT />
<P_XML_DOCUMENT><NemRefusionIndberetningSamling><NemRefusionIndberetningStruktur MessageID="1"><HeaderStruktur><SignOffIndikator>true</SignOffIndikator><TransaktionKode>Opret</TransaktionKode><IndberetningstypeKode>Anmeldelse</IndberetningstypeKode><FravaerTypeKode>Sygdom</FravaerTypeKode><FravaerendeStruktur><FravaerendeTypeKode>Loenmodtager</FravaerendeTypeKode><LoenUnderFravaerIndikator>false</LoenUnderFravaerIndikator></FravaerendeStruktur><IndberetningUUIDIdentifikator>bf9cc44e-af15-4e19-8457-5845d75385d2</IndberetningUUIDIdentifikator><ReferenceAttributTekst>ref. Nielsen-1503831372 (23. oktober 2009)</ReferenceAttributTekst>
but when I try to download the payload or right click on payload to view source I get something like below:
<?xml version="1.0" encoding="UTF-8"?><rfc:HDK083_REFUS_SENDDOCU xmlns:rfc="urn:sap-com:document:sap:rfc:functions"><P_SIGN_DOCUMENT></P_SIGN_DOCUMENT><P_XML_DOCUMENT>& # 6 0;NemRefusionIndberetningSamling& # 62; & # 60;NemRefusionIndberetningStruktur MessageID="1"& #62;& #60;HeaderStruktur& #62;& #60;SignOffIndikator& #62;true& #60;/SignOffIndikator& #62;& #60;TransaktionKode& #62;Opret& #60;/TransaktionKode& #62;& #60;IndberetningstypeKode& #62;Anmeldelse& #60;/IndberetningstypeKode& #62;& #60;FravaerTypeKode& #62;Sygdom& #60;/FravaerTypeKode& #62;& #60;FravaerendeStruktur& #62;& #60;FravaerendeTypeKode& #62;Loenmodtager</FravaerendeTypeKode><LoenUnderFravaerIndikator& #62;false</LoenUnderFravaerIndikator></FravaerendeStruktur& #62;<IndberetningUUIDIdentifikator& #62;bf9cc44e-af15-4e19-8457-5845d75385d2& #60;/IndberetningUUIDIdentifikator& #62;& #60;ReferenceAttributTekst& #62;ref. Nielsen-1503831372 (23. oktober 2009)& #60;/ReferenceAttributTekst& #62;
(extra spaces added to "& # 60" as browser was converting it to < ,>)
If i take the source code for payload and test XSLT mapping, it fails. But if I manually replace all "& # 60" with < and "& # 6 2" with >, then the mapping works fine.
So I think for XSLT map to work correctly, we need to replace all "& # 60 " . Please suggest.
Kind Regards,
Abhijeet. -
Hi All
I am creating a XML file with a procedure.
It works fine but when i want to open it gives the error bcos of '&'
For that i want to use the escape(is it right)
like for description field how can i query to replace '&' with 'AND'
can anyone help me in quering it as well
Please let me know
Thanks
MandarThere's no need to replace the ampersands with 'and'. Encode them before adding them to an XML:
target_string := dbms_xmlgen.convert('string with an & here', dbms_xmlgen.entity_encode);And use "entity_decode" when you're reading from the XML. -
Bought the phone on contract last January (late in january), had my charger replaced just after christmas and now it has stopped working again, its been about a month and a half and the replacement charger is broken, does the replacement charger come with a new warranty or will I have to buy a new charger? And if so, is there a charger that doesn't break easily (my problem is the the wire at the phone end of the cable seems to bunch and twist etc.)
thanks.a warranty replacement if the donor is out of warranty has a new 90 days warranty from exchange date
-
I got a new laptop (Macbook Pro) and my IPhone is synced with my previous laptop (which I no longer have). I've recorded dozens of very long (un-emailable) Voice Memos over the last few weeks and need to get them from my IPhone onto my new laptop.
How do I do this?
(when I click on the Sync option I get the warning: "Are you sure you want to sync music? All existing songs and playlists on the iPhone will be replaced with songs and playlists from your iTunes library." I fear that if I click this I will lose all of my important Voice Memos as well)Just to add to what ChrisJ4203 said. You can sync them to your new computer using iTunes by selecting to Include Voice Memos on the Music tab of your iTunes sync settings and syncing. However, you still need to re-establish syncing with the new computer without iTunes erasing all the iTunes media from your phone (as the warning mentioned).
If you copy your entire iTunes folder (not just your music) from your old computer to your new one, along with other non-iTunes media you may be syncing with iTunes (such as contacts, calendars and any photos synced to your phone from your old computer) by using migration assistant of following one of these methods: http://support.apple.com/kb/HT4527, then when you sync again with your new computer it will recognize your phone and sync as it did before. You will still have to authorize the new computer for any Apple IDs used to purchase from the iTunes and App stores (in iTunes>Store>Authorize this computer).
After that you can sync your voice memos to your computer as mentioned earlier.
If you want to archive your voice memos before you do anything with iTunes, you can use a 3rd party program such as PhoneView or Touch Copy. -
I am using iPhone 4 from the last one year and went dead and got it replaced by paying Rs.12500/- to Nyasa Sion Koliwada Mumbai Service Provider but now again after 38days the problem has started, what do i do? Is this is the quality & service we boost? On visiting the store we get only one reply you may write to Apple directely. we have the similar kind of problem with iPad which is being used by my wife Mr.Neelam Vij and paid Rs.16000/- to get it replaced within a year & 6months use. so in totality we have paid Rs.28500/- + Rs. 3000/- diagnostic charges.
1. iPhone 4 , 32 GB Black with Sr. No. 88******A4T
2. iPad 2, 16GB White with Sr. No.DL*******KPH
Moreover, we have no information to contact whom. even the replace set has a warranty of only three month which further confirm that Apple itself is not confident wheather product will last after replacement for more then three month. Such kind of happening do not encourage anyone to recomend this product to anyone. Would appriciate a faster response to our problem if someone from Apple is going to read this email.
Thanks & Regards
A K Vij
<Personal Information Edited by Host>http://support.apple.com/kb/he57?viewlocale=de_de
India
(91) 1800 4250 744
www.apple.com/in/support/
hope it helps -
Problems with replace file name with starting and ending Bates number
When applying Bates numbers to a set of Acrobat pdf files I am unable to replace file names with the starting and ending Bates number. This is important
for me in a legal application.
The Bates numbers are applied to each page of each of file without any problem as required.
The Bates log file indicates that the files have been renamed as I wanted.
I am running Adobe Acrobat Professional 9 with the update to 9.1.9 and Windows XP Service Pack 3 (the last or current service pack)
In all other respects Adobe Acrobat 9 is running to my satisfaction.
Has anyone else had this problem and found a solution?
HRKExonThanks for asking the question, I hadn't heard of Bates numbers before and this gave me a chance to look up something new.
When I googled for ' bates number legal index ' I found this document:
http://www.adobe.com/devnet/acrobat/pdfs/batesnumbering9.pdf
Maybe that will help.
Scott Bonacker CPA
Springfield, MO -
Powershell (Replacing White Spaces with a comma)
The object property values output tends to be tabular with varying white spaces between each column. I’m looking for a script that will allow me to:
Output the object property values to a file
Remove all white spaces encountered (regardless of the number of spaces)
Replace the spaces with one (1) comma
Replace isn’t the answer unless I literally define each instance of spaces and I can’t find any discernable documentation on using Regex…
-- formattting the output doesn't help either...
Any guidance / help would be appreciated
RoderickLet's say I ran the PowerShell command below:
Get-ClusterResource -Cluster ClusterName | Where-Object {$_.Name -like "SQL Server (*"}
The output would be something along lines of what you see below.
I typically output the result set to a csv file, strip the header, replace the spaces with a single comma, and bulk import the data into a SQL Server table for reporting.
Basically, I'd like a "dynamic way" (not replace with the literal space count between double quotes) of getting rid of the spaces between the columns and replace the spaces with a single comma.
Name State
Group ResourceType
SQL Server (SRV101O) Online SRV101o SQL Server
SQL Server (SRV301O) Online SRV301o SQL Server
SQL Server (SRV201O) Online SRV201o SQL Server
SQL Server (REMSRV101O) Offline REMSRV101o SQL Server
SQL Server (REMSRV301O) Offline REMSRV301o SQL Server
SQL Server (REMSRV201O) Offline REMSRV201o SQL Server
SQL Server (REMSRV401O) Offline REMSRV401O SQL Server
SQL Server (REMSRV501O) Offline REMSRV501O SQL Server
SQL Server (SRV401O) Online SRV401O SQL Server
SQL Server (SRV501O) Online SRV501O SQL Server -
Issue with Commit Work and Wait.
Hi All,
None of the programs are working in my system which are calling BAPI BAPI_TRANSACTION_COMMIT.
On COMMIT WORK AND WAIT statement, the process is going into indefinite loop. Everything was fine till last Thursday and there are no updates or patch level change or notes applied in the system.
Please advice.<div style="text-align:left">We tried everything but still the issue is there.</div>
Normally it's much easier to get help if you try to be as detailed as possible when explaining the problem and what exactly you have tried. No offense, but tried everything most likely translates into almost everything...
Some information/checks I'd be looking for:
<ul style="list-style:square!important">
<li>What functions are (or coding is) involved? Are they all standard or custom?</li>
<li>Have you tried update debugging and/or the usual traces (runtime analysis, SQL trace, etc.)?</li>
<li>What do you see in the process overview?</li>
<li>What about system log, developer trace, database logs/alerts, etc.?</li>
</ul>
Obviously my list is much too short and incomplete - yours must be longer. If you share your results (including your exchange with SAP) I suspect you have a better chance (though of course no guarantee) of somebody providing a valuable clue.
Not sure if it's just me, but the part that sounds so odd and suspicious is that you only mention commits via BAPI_TRANSACTION_COMMIT. As this is just a wrapper around a COMMIT WORK I'm tempted to think it's the functionality that's invoked before (i.e. linked to the registered update functions/modules). Without any additional knowledge though, my first shot was for general update problems (which you ruled out).
Maybe you are looking for
-
Removing photos from iPad without deleting them from computer?
I just bought an Apple Mac air laptop. I have uploaded all my photos from my iPad and, iPod touch. I need space on my iPad. Can I delete pictures from my iPad without deleting from the Apple Mac air laptop? Do I need to change settings on the iP
-
Wake up my computer at home ?
Hello everyone, In office I can use my iMac to do the screen sharing with my Mac Pro at home, however, it will loss the connection if the Mac Pro goes to the sleep mode. Is there a way that I can wake my Mac Pro from my office's iMac, if so, how to d
-
How to plot 2 signal in the same graph but different frequency?
Hi!! I have 2 sensor, motion and EMG.. I want to plot both of the signal (after processing) in the graph (real-time).. The frequency of motion sensor is 128 Hz and for EMG sensor 800 Hz.. When I'm trying to plot (motion and emg) in the same graph, th
-
Create new Business Partner in Loan Area
Hi friends, I am facing the problem following: I can not create a new Business Partner (main Loan Partner) in Loan area. From Create new contract in Loan area, I create a new Business Partner (Organization) -> Result: Display screen is Create new con
-
Is there Cap lock shift lock in Pages for iPad?
Using pages for iPad is there cap lock/shift lock function. It is very difficult to do headings or posters without this function.