Replacing characters between specific characters

Hello,
I need to replace commas in a string with , but only
between " ".
Does anyone know how to do this. I have looked high and low
and tried many things, like trying to find where the first " starts
and the last " but not being able to loop through the rest of the
string to find other occurences.
I would be extremly grateful for someones help/advice
Chris

I would do it in a Java class. Then use Coldfusion to create
an object from that, for any given string. Equip the object with
the following functionality.
Function 1: For any given string s, create the corresponding
String object,
new String(s). Use a loop and the function indexOf("\"",
fromIndex) to iteratively pick out the indices of all the quotes.
If a quote occurs at index N, the next iteration starts with the
value fromIndex=N+1. Store the quotes' indices in pairs (opening
and closing quotes), for example, in a 2D array.
Function 2: Given the original string object and an array of
(beginIndex, endIndex) integer pairs, use the function charAt(n) to
find where a comma occurs in the quoted parts of the string, and
replace each such occurrence with , . Here n is a dummy
integer variable that ranges from beginIndex-1 to endIndex-1 for
each pair of indices.
The following snippet is an attempt I made with Coldfusion.
However, it mistakenly fails to see indexOf as a function of the
String object. And I, alas, am too busy with other things to pursue
this line of interrogation with Coldfusion at the moment. I hope
the snippet conveys enough of the flavour of Function 1 to inspire
you to a solution.

Similar Messages

  • Address book: Find and replace characters?

    Hi all,
    I just imported VCF file from Outlook to Address book. I am in Iceland and the Icelandic characters came wrong. Is there any way to batch find and replace characters in Address book? That is in individual cards.
    Thanks,
    Hilmar

    I believe the only way would be to write an AppleScript.

  • Problem in replacing characters of a string ?

    Hello everybody,
    I want to replace a few characters with their corresponding unicode codepoint values.
    I have a userdefined method that gets the unicode codepoint value for a character.
    1. I want to know how to replace the characters and have the replaced string after the comparision is over in the for loop in my main.
    Currently , i am able to replace , but i am not able to have the replacements done in a single variable.
    The output of the code is
    e\u3006ame
    ena\u3005e
    But i want the output i require is,
    e\u3006a\u3005e
    Please offer some help in this regard
    import java.io.*;
    class Read1
         public static void main(String s[])
             String rp,snd;
             String tmp="ename";
             for(int i=0;i<tmp.length();i++)
                 snd=getCodepoint(tmp.charAt(i));
                 if(snd!=null)
                    rp=replace(tmp,String.valueOf(tmp.charAt(i)),"\\u"+snd);
                    System.out.println(rp);
    public static String replace(String source, String pattern, String replace)
         if (source!=null)
             final int len = pattern.length();
             StringBuffer sb = new StringBuffer();
             int found = -1;
             int start = 0;
             while( (found = source.indexOf(pattern, start) ) != -1)
                 sb.append(source.substring(start, found));
                 sb.append(replace);
                 start = found + len;
             sb.append(source.substring(start));
             return sb.toString();
         else return "";
    ...,Any help in this regard would be useful
    Thanks
    khurram

    This manual replacement thingy reminds me of quite an old technique, when
    64KB of memory was considered enough for 20 users (at the same time that is!)
    Suppose you have a buffer of, say, n characters. Starting at location i, a region
    of chars have to be swapped with bytes starting at location j >= i+l_i; the lengths
    of the two regions are l_i and l_j respectively.
    Suppose the following method is available:public void reverse(char[] buffer, int f, int l_f) {
       for (int t= f+l_f; --t > f; f++) {
          char tmp=buffer[f]; buffer[f]= buffer[t]; buffer[t]= tmp;
    }i.e. the above method reverses a region of characters, starting at position f
    with length l_f. Given this simple method, the original problem can be solved
    using the following simple sequence:reverse(buffer, i, j+l_j);
    reverse(buffer, i, l_j);
    reverse(buffer, i+l_j, j-i-l_i);
    reverse(buffer, j+l_j-l_i, l_i);Of course, when replacing characters we don't need the last reversal.
    kind regards,
    Jos (dinosaurus)

  • Replace images on specific layer

    Hi,
    till now i used the Script-function in InDesign only for "findandchange"-Actions. It works fine and is very time-saving.
    Now I would like to replace images on specific Layers, like I do this with textcontent with the "Findandchange"-Script.
    Is this possible?
    I try to explain...
    Example:
    - Find all images "image-a1.tif"(path:folder/folder/image-a1.tif) on specific layer "mylayer"(or only activ and not locked layers)
    - Replace all this images with this image "image-a2"tif(path:folder/folder/image-a2.tif)
    - Find all images "image-b1.tif"(path:folder/folder/image-b1.tif) on specific layer "mylayer"(or only activ and not locked layers)
    - Replace all this images with this image "image-b2"tif(path:folder/folder/image-b2.tif)
    - Find all images "image-c1.tif"(path:folder/folder/image-c1.tif) on specific layer "mylayer"(or only activ and not locked layers)
    - Replace all this images with this image "image-c2"tif(path:folder/folder/image-c2.tif)
    Background Info:
    These images have all the same size and resolution. They distinguish only in content (english-/france/german elements).
    It's a "multilanguage" InDesign-Document. Every "Languagecontent" have its own layer.
    Thanks for helping...

    Hi,
    Yes you can. I.e using dialog box.
    It could be like this:
    myDoc = app.activeDocument;
    myGraph = myDoc.layers.item("graphic").allGraphics;     // modify layer name
    for (k=0; k<myGraph.length; k++)
         oldLink = myGraph[k].itemLink.filePath;     //whole path
         oldFileName = File(oldLink).name;              //only file name
        newFileName = myDialog(oldFileName);     // new name is read from dialog
         if ( !newFileName ) continue;                         // if user press "cancel" button - no action
         newLink = File(oldLink.replace(oldFileName,newFileName) );    // replace file names within path
         if (File(newLink) instanceof File)                     // if wrong newLink - no action
            myGraph[k].itemLink.relink(newLink);     //relink graphic
    function myDialog(oldName)
        var myWindow = new Window ("dialog", "Replacing images");
        var myInputGroup = myWindow.add ("group");
        myInputGroup.orientation = "column";
        myInputGroup.alignChildren = "left";
        myInputGroup.add ("statictext", undefined, "Old Name: " + oldName);
        myInputGroup.add ("statictext", undefined, "New Name:");
        var myText = myInputGroup.add ("edittext", undefined, ".eps");
        myText.characters = 20;
        myText.active = true;
        var myButtonGroup = myWindow.add ("group");
        myButtonGroup.alignment = "right";
        myButtonGroup.add ("button", undefined, "OK");
        myButtonGroup.add ("button", undefined, "Cancel");
        var OKbutton = myWindow.show ();
            if (OKbutton == 1) myRes = myText.text;
            else myRes = false;
        return myRes;

  • How can I put a time delay between specific events in a while loop?

    How can I put a time delay between specific events within the same while loop? I'm already using the "wait" command to control the overall loop iteration speed. But I want to time the individual events as well.

    Hi Jesse,
    You can use a flat sequence. In each box you can put your individual events and attached wait.
    Don't forget to reduce your total loop time of the time you added in the individual sequences.
    Doc-Doc
    Doc-Doc
    http://www.machinevision.ch
    http://visionindustrielle.ch
    Please take time to rate this answer

  • How can I find unknown number between specific numbers?

    How can I find unknown number between specific numbers? For example I want to find the start with value from following question... How can I do that? If you run this oracle query SELECT DBMS_METADATA.GET_DDL('SEQUENCE','SEQUENCE_NAME') FROM DUAL to find out my sequence DDL you will see the similar given values that assigned to sequence DDL, and if I can find the result here I will apply same technique to my  C# code to find start with value of sequence in oracle.Thanks –
    Given Values
    Min number=20
    Max Number=500
    increment number=10
    start with=?  needs to be find.
    how many times it increments= 5
    where the cycle stopped now= 205
    Conditions;
    1. Start with number has to be either 20 or 500 or between 20-500...
    2. It always increment 5 times.For example, If the start with number is 75 than numbers goes like First cycle=(75,85,95,105,115) Second cycle=(125,135,145,155,165)...Third cycle (175,185,195,205) and it stops on 205.
    Question is If start with number not known. is there any way to find it?
    Thanks!

    DUPLICATE THREAD!
    Please do NOT keep creating duplicate threads.
    https://forums.oracle.com/thread/2578906
    https://forums.oracle.com/thread/2578830
    Your question has already been answered in your other thread. As I said in your other thread:
    The START WITH value part of the DDL for a sequence is NOT stored in the data dictionary. See the SYS.SEQ$ table for the attributes stored in the dictionary.
    What part of that are you having trouble understanding?
    There IS NO START WITH to find - it does NOT exist!
    Mark this thread ANSWERED and continue using your 2578830 thread if you intend to pursue this further.

  • Receiving calendars between specific organizations

    Hello,
    I would like to know if there is any functionality that defines receiving calendars between specific organizations. For example, imagine that for certain products, Org1 Supplies Org2 but since they want to consolidate the shipments, Org2 will just receive goods from Org1 on thursdays.
    Org2 also receive goods from Org3 and due to the same business requirements, they want to receive it on a wednesday.
    Since the calendars are global for each organizations, this is impossible to be done in 11i with normal ASCP functionality.
    We tested using carrier calendar but that did not work very well since the carrier calendar concentrated the planned orders in the sourcing organization (in my example, Org1 and Org3) and not in the destination organization.
    Do you know of any functionality or module that could pottencially attend this requirement? Do we have anything like this in R12?
    Thanks,
    Alberto

    Hi,
    Yes this is possible. Have a look at the chapter "Enabling Cross Domain Searches" in the calendar server admin guide.
    Regards,
    Shane.

  • Replacing characters in a specific region of a String?

    I would like to change characters in a specific region of String.
    For example... change String from "leone24" to "leone31".
    I am not looking to change the occurance of 24 to 31 but the region of 5 to 6, in the above String, from 24 to 31. The characters in this region of the String will vary but the region will always be the position of characters that I want to change in the String.
    Thanks in advance,
    D

    This can be easily done with a StringBuffer:StringBuffer sb = new StringBuffer("leone24");
    sb.replace(5,7,"31");
    String newString = sb.toString();

  • Replace characters between with single * in variable

    Hi Experts ,
    I want to replace all characters between <  > with *. Data is stored in variable type char255.
    Example ,
    Suppose variable contains : Wage Type <Wage Type> Not Valid For Interface ID <ID>
    I want output as Wage Type * Not Valid For Interface ID *.
    Thanks & Regards ,
    Jigar Thakkar

    Hi Jigar,
    Find the length of the string and use DO...ENDDO statement. Inside the loop, didnt consider the text between < and > and move to another string and add * when  > is encountered in the string.
    data:
      gv_len type i,
      gv_str type string value 'Wage Type <Wage Type> Not Valid For Interface ID <ID>',
      gv_rep_str type string,
      gv_flag type char1,
      gv_index type sy-index.
    gv_len = strlen( gv_str ).
    do gv_len times.
    gv_index = sy-index - 1.
    if gv_str+gv_index(1) = '<'.
    gv_flag = 'X'.
    continue.
    elseif gv_str+gv_index(1) = '>'.
    clear gv_flag.
    concatenate gv_rep_str '*' into gv_rep_str.
    continue.
    elseif gv_flag is initial.
    concatenate gv_rep_str gv_str+gv_index(1) into gv_rep_str.
    endif.
    enddo.
    write:/ gv_rep_str.
    Thanks,
    Vinay
    Edited by: Vinaykumar G on May 29, 2009 8:04 PM

  • VBA Word Find and Replace characters but excluding certain characters

    I am trying to write VBA code in Word that I will eventually run from a VBA Excel module. The aim of the project is to find specific strings in the open Word document that have length of either one or two characters and are of a certain format, and replace
    them with other strings in the same format. This is to do with transposing (i.e. changing the musical key) of chord symbols in a songsheet in Word. The Find and Replace strings are contained in ranges in an Excel workbook, which is why I want to eventually
    run the code from Excel. I'm much more experienced in writing VBA code in Excel than in Word, and I'm fairly confident with transferring the 'Word VBA' code into an Excel module.
    At the moment I'm trying out code entirely in Word, and I've come across a stumbling block. For example, I want it to Find "A" and replace with "B",
    BUT only if the "A" is NOT followed by "#" (sharp) or "b" (flat).
    Here is the code I've got in Word VBA, which I obtained by editing code produced by the recorder:
    Sub F_R()
    'Find text must have specific font
    With Selection.Find.Font
    .Bold = True
    .Underline = wdUnderlineWords
    .Superscript = False
    .Subscript = False
    End With
    'Replacement text must have specific font
    With Selection.Find.Replacement.Font
    .Bold = True
    .Underline = wdUnderlineWords
    .Superscript = False
    .Subscript = False
    End With
    'Find & Replace strings
    With Selection.Find
    .Text = "A" 'hard-coded here for testing, but this will
    'eventually be referenced to a cell in Excel
    .Replacement.Text = "B" 'hard-coded here for testing, but this will
    'eventually be referenced to a cell in Excel
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = True
    .MatchWholeWord = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    End Sub
    For the Find & Replace section I want to do something like:
    With Selection.Find
    .Text = "A"
    .Text <> "A#"
    .Text <> "Ab"
    .Replacement.Text = "B"
    End With
    - but this produces a syntax error, presumably because you can have only one .Text line (or it won't accept <>?)
    I tried adopting the way of excluding chars when using the Like operator, and while it compiles, it will not replace
    any "A":
    With Selection.Find
    .Text = "A[!b#]"
    .Replacement.Text = "B"
    End With
    I suspect that I'm going to have to change tack completely in the way I'm doing this. Do you have any suggestions, please?
    The chord names/symbols are preceded/succeeded by either spaces or paragraph returns and can look like these, for example (all Font Bold and Underlined words only):
    C<sup>7</sup>
    Dm<sup>7</sup>
    Eb<sup>-5</sup>
    Bb<sup>+11</sup>
    F#m<sup>7</sup>
    i.e. [ABCDEFG][b # | optional][m |optional][- + | superscript, optional][2 3
    5 6 7 9 11 13 | superscript, optional]
    The crux of my problem is that the note A should be treated as entirely distinct from Ab or A# (and similar for other flattened/sharpened notes).
    Sorry for long post.

    Hi Ian,
    It is not easy to find Microsoft forums. However this forum is for the Visual Studio Net version. 
    Try this forum for VBA.
    https://social.msdn.microsoft.com/Forums/en-US/home?forum=isvvba
    Success
    Cor

  • Search and replace characters in a string

    I am very new to Sharepoint and need your help.  I have set up a calculated column in a sharepoint list that combines a IT release number to its Release title.  The list is set to appear on a calendar plus web part.  The idea is to show
    the title and release number of all deployments going to the field on a particular day.  The issue is that the release number has a bunch of zero's in it that I do not need to be displayed.  For example a release number could be "RND000000123456". 
    I need to parse out "D000000" so only "RN123456" along with its title show up on the calendar.  Please help!!

    Go here and search for "Remove characters":
    http://msdn.microsoft.com/en-us/library/office/bb862071(v=office.14).aspx
    From that page:
    Remove characters from text
    To remove characters from text, use the LEN, LEFT, and RIGHT functions.
    Column1
    Formula
    Description (possible result)
    Vitamin A
    =LEFT([Column1],LEN([Column1])-2)
    Returns 7 (9-2) characters, starting from left (Vitamin)
    Vitamin B1
    =RIGHT([Column1], LEN([Column1])-8)
    Returns 2 (10-8) characters, starting from right (B1)
    You could also try the REPLACE function:
    http://office.microsoft.com/en-us/windows-sharepoint-services-help/replace-function-HA001161055.aspx
    Brandon Atkinson
    Blog: http://sharepointbrandon.com

  • Find and replace characters in file names

    I need to transfer much of my user folder (home) to a non-mac computer. My problem is that I have become too used to the generous file name allowances on the Mac. Many of my files have characters such as "*" "!" "?" and "|". I know these are problems because they are often wild cards (except the pipe). Is there a way that I can do a find and replace for these characters?
    For example, search for all files with an "*" and replace the "*" in the file name with an "@" or a letter? I don't mind having to use the terminal for this (I suspect it will be easier).
    Is this possible? Does anyone have any suggestions?
    Thank you in advance for any help you may be able to provide.
      Mac OS X (10.4.8)  

    Yep.
    "A Better Finder Rename" is great for batch file renaming.
    http://www.versiontracker.com/dyn/moreinfo/macosx/11366
    Renamer4mac may be all you need.
    Best check out VersionTracker. In fact everybody should have this site bookmarked and visited daily.
    http://www.versiontracker.com/macosx/

  • Replace characters in a string

    Hi,
    I need to replace all occurrences of control characters except space,newline,tabs in a string . I can give a replace statement for each of these characters but I want to avoid this by making use of regular expressions. Can anyone help me in this regard.
    I tried using the following replace statements with regular expression, but i am not getting the required results:
    replace all occurrences of REGEX '[[:cntrl:]]' in lv_char with space replacement count lv_count_r.
    ---> this replaces even the spaces
    replace all occurrences of REGEX '[[:cntrl:]][^[:space:]]' in lv_char with space replacement count lv_count_r.
    --> this replaced even some alpha numeric characters
    Thanks and Regards,
    Shankar

    is there anyway to do this without using regular
    expressions.. regular expressions are the last
    solution for me..Remember that you can never really replace the characters of a String. Strings are immutable. Once created they cannot change.

  • Replace characters in chat text

    I was written a small applescript to replace some characters in chat message. Here is my code.
    property searchList : {"live"}
    property replaceList : {"love"}
    to switchText of t from s to r
       set text item delimiters to s
       set t to t's text items
       set text item delimiters to r
       tell t to set t to beginning & ({""} & rest)
       t
    end switchText
    to convertText(t)
       set d to text item delimiters
       considering case
           repeat with n from 1 to count searchList
               set t to switchText of t from my searchList's item n to my replaceList's item n
           end repeat
       end considering
       set text item delimiters to d
       t
    end convertText
    using terms from application "Messages"
       on message sent theMessage for theChat
           try
               return convertText(theMessage)
           end try
       end message sent
       on message received theMessage from theBuddy for theChat
           return convertText(theMessage)
       end message received
       on chat room message received theMessage from theBuddy for theChat
           return convertText(theMessage)
       end chat room message received
    end using terms from
    This code worked fine for Yahoo account, but it dont work when i received messages from iMessage and Jabber account. I tried to look into Alerts event and i found "Message received in active chat" ,maybe iMessage and Jabber account use this event to alert received message, but the problem is this object not defined in applescript. How can i define it, or make this code work with  iMessage and Jabber account.

    after long long times for google and test myseft, i found yahoo account have problem too, because active chat why is apple dont define this object ""Message received in active chat"'

  • Replacing characters in a string

    I have an application where a user can enter information into a webform. I'm using JSP, but of course the backend there is a Java function also.
    I am trying to write a function which will replace when the user hits enter with a <br> (break tag).
    Right now it's a complicated, messy loop to look at each character and it has many flaws.
    Is there a "replace" function that will do this for me?
    However, I don't think in a webpage form it transfers the \n end of line characters.

    Nope compiler error
    symbol : method replaceAll (java.lang.String,java.lang.String)
    location: class java.lang.String
    return (txt.replaceAll("\n","<br>"));

Maybe you are looking for

  • Nokia 6300 Text Message Options

    I own a Nokia 6300 which was Made in Hungary. It came with firmware revision version 5.00. I only see 6 options in my Text Message Settings and nothing seems to resolve it. There's supposed to be 10 options. I contacted Nokia care centre and they sug

  • How do I add the system classpath to Jar Manifest Class-Path

    My application is implemented on win2000 and need to be moved to unix as a executable jar file, the oracle jdbc classes (classes12.zip and classes111.zip) were included in MANIFEST.MF as the following: Class-Path: /Oracle/Ora81/jdbc/lib/classes12.zip

  • WiFi doesn't connect automatically on open

    Since upgrading to Mavericks my WiFi connection does not automatically connect when waking from sleep. Sometimes if I click on my account it connects, other times I have to turn WiFi off then back on and it connects. Once connected it is fine. I have

  • Problem in printing Address Type 3

    Hi Experts, This post is in context of Address type 3 (Contact Person). Please see the below mentioned code  which has been coded in the script : /:           IF &VBDKA-ZZADRND& EQ &SPACE& /:           IF &VBDKA-ADRNP_2& EQ &SPACE& /:           ADDRE

  • Distinguish between pure AS3 and Flex project

    Hey, how can I distinguish if I am compiling currently an AS3 or a Flex project (mxml vs. pure as)? I acutally want to look something up in the "evaluate" method of a GenerativeFirstPassEvaluator before doing the processing. So I need to know it ther