Translate and replace

what is the difference between translate and replace.

SQL> -- TRANSLATE replaces by position, the 1st character of the list to match is replaced by the SQL> -- 1st character of the replacement list. The 2nd character with the second, and if there are
SQL> -- characters in the list to match that do not have positional matching in the replacements
SQL> -- list they are dropped.
SQL> select translate('ABCABC','A','1') as str from dual;
STR
1BC1BC
SQL> -- REPLACE replaces the exact string to match with the replacement string
SQL> select replace('ABCABC','AC','1') as str from dual;
STR
ABCABC

Similar Messages

  • Query to Translate and Replace: Pls Help

    I have a table which contains days of the week (in numbers) in a comma separated format. I need to replace the numbers with "Abbreviated Days of the Week"
    For example, I ahve some sample rows as
    1
    1,2
    1,5,6
    3,5
    This must be printed out as
    MON
    MON,TUE
    MON,FRI,SAT
    WED,FRI
    In the above case, 0 is replaced by SUN, 1 by MON and so on...

    why not a simple (although scarry looking) nested replace?
    replace(replace(replace(replace(replace(replace(replace(the_column,'0','SUN'),'1','MON'),'2','TUE'),'3','WED'),'4','THU'),'5','FRI'),'6','SAT')Regards
    Etbin
    Message was edited by:
    Etbin

  • How can I search and replace fonts?

    iOS 7 doesn't support the Adobe workhorse fonts I've most relied on for years, and arbitrarily changes them to iOS built-in fonts when I link my standard documents and templates to the iPhone, via iCloud. There's no apparent logic to how it does this; a Pages document in Minion Pro, a serif font, gets changed to the sans-serif Helvetica. Myriad Pro may come out in Times New Roman. I accept that the iPhone's limited number of fonts makes translation necessary, but does Pages offer a way in which I can search and replace inappropriately substituted fonts for more logical alternatives?

    You noticed the first one yourself: the Found item list seems to randomly jump around the document -- I believe you are correct in your observation it may be due to the object construction order. That tells me, by the way, something about your lot numbers that tou didn't mention: your text is not one continuous long threaded story, but it's all or partially in disconnected etxt frames. The Found list does return everything inside a single story in the correct order, but it goes over each separate story in the order they were constructed.
    The only solution is to gather all of your lot numbers, *re-sort* them according to the page number they appear on (and some sort of Worst Case Scenario is when you might have more than one lot number frame per page; in that case you also need to sort by textframe, top to bottom -- yet even worse is if you also may have these textframes side by side!).
    Only then you have a reliable counting order.
    This isn't too bad. We can just extend the method I offered for sorting top-to-bottom/left-to-right in Re: Working around the frame selection order issue in CS 4 and make it also include page numbers:
    function byPageYX(a,b) {
        var
            aP = a.parentTextFrames[0].parentPage.index,
            bP = b.parentTextFrames[0].parentPage.index,
            aY = a.baseline[0],
            bY = b.baseline[0],
            aX = a.horizontalOffset[1],
            bX = b.horizontalOffset[1],
            dP = aP-bP,
            dy = aY-bY,
            dx = aX-bX;
        return dP?dP:(dy?dy:dx);
    myResults.sort(byPageYX);
    Or something like that.
    As for actually implementing the above I cannot be of any help with Applescript.
    Once we're dealing with sorting I think you're much better off in Javascript anyhow.

  • Dreamweaver cs3 international edition crashes while "Find and Replace"

    When i try to perform Find and Replace in Adobe Dreamweaver CS3
    the program halts and crashes everytime.
    aditional info:
    Adobe Dreamwever CS3
    international version (translated GUI)
    Version 9.0 Build 53
    Windows Vista
    Pentium Core2duo 2gb ram
    best wishes..
    ozgur z

    Mr David Powers thank you for your quick,
    sorry to say but
    the link did not work for me.
    i am so ashamed to use a program that crashes while doing a simple "search and replace" action! which i had paid more than 900$.
    and also it is so interesting that adobe has released new version CS4 instead of updating the buggy CS3. so the ppl who bought CS3 are dumped!
    here i attach the crash error dump file that Dreamweaver creates in its configuration directory.
    http://rapidshare.com/files/230314270/Dreamweaver_crash_log.mdmp
    i hope it helps to diagnose and SEARCH and REPLACE the BUG.
    best wishes
    o.z.
    edited by: OzgurZ (inserted the rapidshare link for the dump file)
    Message was edited by: OzgurZ - NOT answered yet.

  • Finding and replacing (international??) characters

    I'm having trouble finding and replacing characters. Can anyone help me see the wood for the trees?
    The characters in question are single quote characters (I asume) which have been entered in a windows box/word program/filemaker progremme or some other. As such, when I open them in a flat file on my Mac I see the following:
    �A L O E�
    where the "�" and the "�" should actually be single quotes.
    On my Mac I can weed these out with the following:
    public String cleanString(String text)
         if(text != null && text.length() > 0)
              if(text.indexOf("�") > -1)
                   text = replace(text, "�", "'");
              if(text.indexOf("�") > -1)
                   text = replace(text, "�", "'");
              if(text.indexOf("�") > -1)
                   text = replace(text, "�", "'");
              if(text.indexOf("�") > -1)
                   text = replace(text, "�", "'");
         return text;
    }But on my server (Linux) this just isn't working. It doesn't find the characters. I've tried converting each character to unicode and looking for it that way.
    public String cleanString(String text)
         String cleaned = "";
         if(text != null && text.length() > 0)
              boolean flag = false;
              for (int i = 0; i < text.length(); i++)
                   int j = (int)text.charAt(i);
                   String u = Integer.toHexString(j);
                   if("221a".equals(u))
                        flag = true;
                        continue;
                   if(flag && "b4".equals(u) || "2260".equals(u) || "a8".equals(u) || "c6".equals(u))
                        cleaned += "'";
                        flag = false;
                   else
                        if(flag)
                             cleaned += text.charAt(i -1) + text.charAt(i);
                        else
                             cleaned += text.charAt(i);
                        flag = false;
         return cleaned;
    }But the same thing happens. It works on my mac, but not on my server.
    Part of my problem is that these 'offending characters' are actually comprised of two chars:
    eg:
    '\u221a' + '\u00b4'
    Can anyone point me in the right direction?

    As such, when I open them in a flat file on my Mac I see the following:First you should open the file using the correct character encoding. Since the file originates from a Windows box, the encoding is probably Windows-1252, aka CP1252. You'll find the code for opening and reading here, just change "UTF-8" to "CP1252."
    http://javaalmanac.com/egs/java.io/ReadFromUTF8.html
    Next, you should not write non-ASCII characters in source code because it is not portable. If the source code is moved from one system to another, like from Mac OS X to Linux, the way the compiler translates bytes to characters may change. Only ASCII is safe, so it is better to use the portable Unicode escapes (\uXXXX) to represent non-ASCII characters in strings.
    From Microsoft's own reference, the "smart" single quotes are U+2018 and U+2019: http://www.microsoft.com/globaldev/reference/sbcs/1252.mspx
    so the code to replace them would be
    text = text.replace('\u2018', '\'');
    text = text.replace('\u2019', '\'');You would need to do the same for the double quotes, \u201C and \u201D
    btw as there's a method for replacing charcters in the String class, you don't need to write a new one

  • Translate and next day function

    hi everybody, i am trying to learn how translate and next_day function works in oracle.
    i have the following query
    select translate(to_char(sysdate,'yyyy/mm/dd'), 'A0123456789','A') FROM DUAL;
    when i execute it, the result is //
    my question is why is that, i thought it suppose to be AAAA/AA/AA
    translate suppose to replace any character in the string 'A1234...' with A
    but this is not happening. can somebody explain how is this working?
    also i have this query
    select next_day(to_date('06/23/1998','mm/dd/yyyy'), 'friday') from dual;
    when i execute it, it gives me 6/26/98 which is a thursday and not a friday. again why is this?
    when i execute this query, select next_day(to_date('07/10/2000','mm/dd/yyyy'), 'friday') from dual;
    i get 7/14/2000 which is correct. any ideas on this?

    Hi,
    Whenever you have a question about a function, start by looking at the [SQL Language manual|http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/functions204.htm#sthref2476].
    Under "Translate", the very first paragraph looks like it was written in response to your question:
    "TRANSLATE returns expr with all occurrences of each character in from_string replaced by its corresponding character in to_string. Characters in expr that are not in from_string are not replaced. The argument from_string can contain more characters than to_string. In this case, the extra characters at the end of from_string have no corresponding characters in to_string. If these extra characters appear in expr, then they are removed from the return value."
    I find it helpful to write the 3rd argument of TRANSLATE directly under the 2nd argument, to make it clear with what each character of the 2nd argument is being replaced:
    select  translate ( to_char (sysdate, 'yyyy/mm/dd')
                , 'A0123456789'
                , 'A'
    FROM      DUAL;makes it clear that (for example) '5' will be replaced with nothing (that is, removed) because there is nothing directly below '5'.
    On the other hand:
    select  translate ( to_char (sysdate, 'yyyy/mm/dd')
                , '0123456789'
                , 'AAAAAAAAAA'
    FROM      DUAL;makes it clear that '5' will be replaced with 'A', because there is an 'A' directly below '5'.
    Notice in the last example, there's no need to include 'A' in the 2nd argument.

  • Search and Replace help. Please

    I have imported some text where in the original there is italic content but when bringing into IDCS4 that italic text shows up as _italic words_. That is as roman with _ characters surrounding it. Is there a way to search and replace. Needless to say the text between the _s varies.

    I would try a GREP find/change searching for (_)([^_]+)(_) and replace with $2 Set the change formatting to italics (preferably as a character style).  This translates to look for a _, then anything that is not a _, followed by another _, and replace with only the stuff in between. You can also use (_)(.+?)(_) which would match the shortest srting in between two _ characters in the same way (except it won't cross a paragraph break), but it will run a bit slower.
    Credit for this should go to Peter Kahrel and his excellent GREP primer....

  • How can I create an action that uses "Find and replace"?

    Hi there,
    I'm trying to create an action that will use "Find and replace" to change certain words and phrases in my .psd-files. These are words and phrases I change a lot (I'm translating emails and website banners) and I would like to speed up that process using actions.
    When I tried to create the action I got the error message "The object "in contents of all text layers" is not currently available".
    Then I tried "insert menu items" and chose "Find and replace" and then did my change, but then it stopped when the FAR-window popped up. That's what I want to skip, so it just changes my words and phrases that I want.
    Is this possible?
    Best,
    Carl

    Anyway, in the Script in that other thread the function replaceText takes two Strings, so something like
    function main () {
    var myDocument = app.activeDocument;
    replaceText ("replace this", "with this")
    would be a possibility.

  • Find and replace smart quotes with straight quotes?

    I understand I can turn off smart quotes so that I can type straight quotes, but I need to replace hundreds of curly smart quotes with straight quotes, is there a feature that will let me do this? I am using FM8.
    Thanx,
    Willian

    I am using FM9....so I don't know if the same shortcuts apply, but this is what I found out last week.
    Use the Find and Replace tool:
    With smart quotes turned off and the Num Lock key turned on:
    Alt0147 will give you beginning quotation marks
    Alt0148 will give you ending quotation marks
    In the Find box use ALT0147 or ALT0148 for the beginning or ending quotes. When you click in the box and type
    one of the shortcuts the correct quote will be shown in the box.
    In the replace box type the regular straight quotes on your keyboard.
    I was thrilled that it would work!...course you do have to do them separately and be careful not to replace the curly quotes
    that you want to leave in your document.
    Hope this helps using FM8....
    ls

  • Use VBA and Excel to open Dreamweaver HTML (CS5), find and replace text, save and close

    I wish to use VBA and Excel to programmatically open numbered Dreamweaver HTML (CS5) and find and replace text in the code view of these files, save and close them.
    I have  5000 associations between Find: x0001 and Replace: y0001 in an Excel sheet.
    I have the VBA written but do not know how to open, close and save the code view of the ####.html files. Please ... and thank you...
    [email protected]

    This is actually the code view of file ####.html that I wish to find and replace programmatically where #### is a four digit number cataloguing each painting.... In 1995 I thought this was clever... maybe not so clever now :>)) Thank you for whatever you can do Rob!
    !####.jpg!
    h2. "Name####"
    Oils on acrylic foundation commercial canvas - . xx X xx (inches) Started
    Back of the Painting In Progress </p> </body> </html>
    Warmest regards,
    Phil the Forecaster, http://philtheforecaster.blogspot.ca/ and http://phils-market.blogspot.ca/

  • How do I find and replace text in PHP files?

    How can I in CS3 make sitewide changes to the text in PHP pages without changing variable names etc that have the same name?
    For example if I have an installation of a PHP forum and I want to change every instance of the word 'forum' to 'message board'...
    If I used the 'inside tag' search with " as the tag, then if "" contained a variable called 'forum' it would also be changed and therefore corrupt the code....
    Is there a simple way around this?
    Thanks!
    I'm using CS3 on Windows Vista.

    It looks like you're trying to find and replace source code, so you may be able to look at the various places that are looked at when finding and uncheck the ones that don't apply.
    But, if it's all source code then that won't help.  One thing that may work is to expand the search option - for example if the work "forum" that you're wanting to change it preceded by another word, or character or something that sets it apart, then do you find on that. You can expand that search phrase as far out in either direction that you need to to make it different, if of course that is practical in your situation.
    The only other way I can think of is to somehow create an exception rule, but I'm not sure if that's possible or how to do it.

  • Using a variable in a Powershell search and replace string

    Hi
    a couple of days ago I posted a question about doing a search and replace with wildcards
    Search and repalce with Widcards
    I got a swift and very helpful answer but now I need to build on it.
    In a text file I wanted to replace all the text between two defined words.  the script I got was this
    $text = 'Some Server this bit of text varies Language stuff'
    $text -replace '(.*Server) .+? (Language.*)','$1 it will always say this $2'
    It works great but now I want to replace "it will always say this" with a variable and I can't figure out the correct grammar to make this happen.
    Can anyone help??
    Thanks
    Alex

    Here's one way:
    $replace = 'it will aways say this'if ( $text -match '(.*Server) .+? (Language.*)' )
    { "{0} $Replace {1}" -f $matches[1,2] }
    else { $text }
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • I used someone else's computer to update my iPhone and when it was done all of my content was gone and replaced with the computer owner's content.  Can I get my stuff back?

    My boyfriend wanted to update his iPhone so I let him use my computer/iTunes to do it because he does not have his own.  When we plugged his phone in it brought up his name to select and then we began the update.  After it was done and his phone came back up it had deleted most of his info he had like contacts and replaced it with my contact list.  Is there anyway to get his info back and restored to his phone?  Help!!

    You can only sync to 1 iTunes library on one computer.
    If you sync to another, you get what happened to you.
    If you have not backed it up on your computer, where you originally synced to, you are out of luck.
    If you did backup up, read this:
    http://support.apple.com/kb/ht1766

  • How can I get my data back after a family member hacked into my iphone and replaced my data

    A family member hacked into my iPhone and replaced my data with his own data. I am afraid to plug it into iTunes for fear of overwriting my backup. iCloud probably already overwrote. Can I restore the phone without synching first, and then use Time Machine to get back to an earlier backup and re-synch?

    Over two years and no spsonse to this? will there be any point me asking the same?

  • How to Edit and Replace Psd Files in Adobe Flash - Help!

    Hi Everyone,
    I am new to flash and I am trying to build my first flash site using a flash template. I can use flash to edit certain components like header text, etc. But The content is impossible for me to change. I think that these are psd files, which I can open with gimp or another program and edit. I save and replace that file, but when I view movie again, the content is the same. I guess what I need to know is how to get these files back into my flash movie after I have edited them. Please help, I am no computer expert, but I am learning. A how to for dummies answer would be awesome.

    Maybe You should try the Flash-forum:
    http://forums.adobe.com/community/flash

Maybe you are looking for

  • Is there an app to find duplicate photos on my ipad2 ios 7.04

    I have many photos stored on my ipad and probably through sheer incompetence have managed to produce an awful lot of duplicates. There seem to be several apps to identify such duplicates so that they may be deleted easily but I can only find apps des

  • Date insert problem m/d/yy not working

    I am trying to set up the 'birthday' date like in the 'contact management' tutorial in my user account section... For some reason, although my birthday set-up is just like the tutorial (MySQL field 'date' set as DATE, ADDT date setting is m/d/yy) and

  • Is there a dual video sources workflow anywhere for Podcast Producer 2?

    I looked at the standard "dual source" workflow, but the QTZ compositions appear to use output from a plugin rather than direct "video input" patches. I'd love to be able to plug in both a Canopus ADVC-55 firewire codec (to capture PTZ camera image)

  • Restore ichat history after system restore

    Haven't found a usable solution to this problem yet, so help is greatly appreciated. How do you restore all of your iMessage (iChat) conversations after retiring your Mac to an earlier point in time.  Specifically, I used Time Machine to return my iM

  • Muse Site Returning Error Only in Chrome that Files are Missing

    I created www.helixweb.co.uk today, and I have an isse. Using Safari, Firefox and IE, there are no problems with my site. Every page loads fine for me. However when I then go into Chrome.... I get this error(I only get it on the Advertising menu of t