Replace last occurrence of a word in string

Hi,
I need to replace a last occurrence of a word in string. Form example:
'I like fruits and also like vegetables'  need to replace last occurrence of "like" which is just before vegetables and not the "like" before the fruits.

One of the solution to use the last occurrence dynamically
applicable to prior version of 11g
SELECT REGEXP_REPLACE (str, 'like', 'hate', INSTR (str, 'like', -1))
  FROM (SELECT 'I like fruits and also like vegetables also like mango' str FROM DUAL)
applicable to 11g
SELECT REGEXP_REPLACE (str, 'like', 'hate', 1, REGEXP_COUNT (str, 'like'), 'i') data_col
  FROM (SELECT 'I like fruits and also like vegetables also like mango' str FROM DUAL)

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.

  • Replacing all occurrences of characters in a string with one new character?

    Hi there,
    I'm looking for a way that I could replace all occurrences of a set of specific characters with just one new character for each occurrence.
    For example if I have a string which is "word1...word2.......word3....word4............word5" how would I be able to replace this with just one character such as ":" for each set of "." so that it would essentially appear like this "word1:word2:word3:word4:word5"
    If I just use replace(".", ":") I am left with "word1:::word2:::::::word4::::word5::::::::::::"
    So therefore I'm guessing this would require the use of replaceAll() maybe? but I'm not really very familiar with how regular expressions work and how this would be accomplished using them.
    Any help would be greatly appreciated :) Thanks.

    Yes, but "." means any character, so ".\+" means "any character repeated more than once". If you just mean a full stop ("period" for you Americans :p) you should use "\.+" as your regular expression, but remember that for Java you need a '\' escape to recognise '\' as '\', so in code you'd actually type your regex as:
    "\\.+"Here's an example of one way to do it:
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    public class Test {
        public static void main(String[] args) {
           String string = "example1.......example2...example3.....example4";
         Pattern pattern = Pattern.compile("\\.+");
         Matcher stringMatcher = pattern.matcher(string);
         string = stringMatcher.replaceAll(":");
         System.out.println(string);
    }Edited by: JohnGraham on Oct 24, 2008 5:19 AM
    Edited by: JohnGraham on Oct 24, 2008 5:22 AM

  • Replace all occurrences of ENTER in a string

    Hi,
    I have a string which contains line breaks:
    '<HTML><HEAD>
    </HEAD>
    <BODY>'
    and it is shown to me in the debugger as:
    '<HTML><HEAD>#</HEAD>#<BODY>'
    Now I want to replace all line breaks in the string,
    but
    replace all occurrences of `#` in text with ' '.
    doesn't work.
    So if you have an idea how to replace the # symbol for Enter in a string please tell me ;).
    regards,
    Stefan

    Hi,
    Pls use
    replace all occurences of '#' in text with cl_abap_char_utilities=>newline.
    Eddy

  • OBIEE - Find position of the last occurrence of a charcter within a string.

    Hi,
    I have a requirement in 11.1.1.6.9 to be locate the position of the last occurrence of a character within a string.
    i.e. Given the following, I would want to locate the last "/":
    This/is/an/exampleI would like to return a value of 11. Now, there could be any number of "/" so I can't always locate the nth one - it must be the last one.
    Anyone any ideas?
    Thanks,
    John

    Your requirement is not complete. just in case you want to extract the last part 'example' just use substring and replace to trim up to required part.
    You may have to go for the same for multiple times.
    ETL is the best to handle this than BI.
    BTW: Check this How to use locate function if multiple occurences of same character
    Edited by: Srini VEERAVALLI on May 10, 2013 10:25 AM
    Good that given link is helped you to solve it ;)
    Edited by: Srini VEERAVALLI on May 13, 2013 7:47 AM

  • Last word of string!

    Hi, My problem is I want to return the last word of a string.......
    I have tried these 2 methods but it didn't worked can anypne help?
    public class news {
              //construct String
    private String str;          
    public static String lastWord(String str) {
         StringTokenizer st = new StringTokenizer(str);
         int tokenCount = st.countTokens();
    // the tokenCount gives you the number
    // of white space separated Strings
    // in the original String
         int count = 0;
         String lastWord = "";
              while (st.hasMoreElements()) {
              count++;
                   if (count != tokenCount) {
                        st.nextToken();
                   else {
                        lastWord = st.nextToken();
              } return lastWord;
    /*public String lastWord(String str) {
         for (int i=0; i<str.length(); i++){
         //str = new StringBuffer(str).charAt(str.length()-1);
         char c =str.charAt(str.length()-1);     
    return (c);
    public static void main (String [] args)     {
              news str = new news ();
              System.out.println("Last word of string is"+str.lastWord("Java technology"));
    }

    It is looking correct code, but my problem that it doesn't complie & give me this error, as I'm new I don't know what this error suppose to mean and why doesn't it compile? :(
    --------------------ERRORS-----------------------
    C:\javahw>javac news.java
    news.java:8: cannot resolve symbol
    symbol : class StringTokenizer
    location: class news
    StringTokenizer st = new StringTokenizer(str);
    ^
    news.java:8: cannot resolve symbol
    symbol : class StringTokenizer
    location: class news
    StringTokenizer st = new StringTokenizer(str);
    ^
    2 errors

  • Get the second last occurrence of character

    Hi
    I want to get the second last occurrence of "_" from the following string and then take the 3 characters before this.
    Does anyone know how to do it in a simple query?
    The string is
    ALS_AKM-G-2500_BASED_pre_paid_akm_mis_stv1

    user2360027 wrote:
    I wanted a simple query. The regular expressions are too much for me to understand :-)Not difficult at all:
    regexp_replace(txt, '.*(.{3})_[^_]*_.*$', '\1')
    \------------------/ \/\----/|\---/|\/|   \--/
             |           |    |  |  |  || |    |
             |           |    |  |  |  || |    and replace that found matching pattern with what is in backreference 1
             |           |    |  |  |  || |                                    (the 3 characters found in the pattern)
             |           |    |  |  |  || followed by the end of the string
             |           |    |  |  |  ||
             |           |    |  |  |  |followed by any characters
             |           |    |  |  |  |
             |           |    |  |  |  followed by an "_" character
             |           |    |  |  |
             |           |    |  |  followed by any number of non "_" characters
             |           |    |  |
             |           |    |  followed by an "_" character
             |           |    |
             |           |    followed by any 3 characters (mark as a back reference using brackets)
             |           |
             |           where it matches any number of characters
             |          
             replace the section of string txt

  • Function to replace/delete specific character(s) in a string

    Hi, experienced CVI guys,
    Are there some functions shipped with CVI to replace or delete specific characters in a string?
    For example, I want to replace all \/|- with an empty string, or to delete them. What can I do?  Loops are too complex.
    Original string:
    Erasing Device...
    \|/- \ \ \\|/-\|/ \
    Report
    07-Sep-2010, 08:04:55
    Result I want is
    Erasing Device...
    Report
    07-Sep-2010, 08:04:55
    Thanks.
    Solved!
    Go to Solution.

    labc:
    How generic do you want to make your filter?
    For our discussion, I'll call your series of characters a text spinner.  I'm assuming the number of characters in it may vary, but that the pattern is consistent in the respect: the spinner is made up of characters like \ / | -, each followed by the ASCII backspace (char) 8.  (That's 8 cast as a character, which is not the same as '8'.)  In your sample spinner pattern, every occurrence of the ASCII backspace is preceded by one of the spinner characters.  Let's assume that this pattern is constant.
    So what I'd do is search through your input string (yes, using a loop) and copy the input string byte by byte to an output string.  If you find an ASCII backspace in the input string, skip it, and overwrite the last character in the output string (which is one of the spinner characters) with the next character in the input string.
    Yes, you are using a loop, but it's not too complex.
    Here's the whole loop, written as a function.
    // filterSpinner function to strip the text spinner characters out of a string.
    // The text spinner is made up of \ / | - characters separated by (char) 8 (ASCII backspace)
    int filterSpinner(char *inputString, char *outputString)
     int inputPtr, outputPtr = 0;
     // walk though the input string
     for (inputPtr = 0; inputPtr < strlen(inputString); inputPtr++, outputPtr++)
      // search for the ASCII backspace character that's part of the spinner
      if (inputString[inputPtr] == 8)
       // if the ASCII backspace is found,
       inputPtr++;  // increment the inputString pointer to skip the backspace
       outputPtr--; // decrement the outputString pointer to overwrite
           // the spinner character that preceded the backspace
      outputString[outputPtr] = inputString[inputPtr];
     outputString[outputPtr] = '\0';
     return 0;
    You'll also find an attached CVI program which uses it on your sample string.
    Attachments:
    FilterSpinner1.zip ‏5 KB

  • Tell me Logic for search for duplicate words(or strings) in a large file.

    Search for duplicate words (or strings) in a text file containing one word per line. For each word that occurs more than once in the flat file output should be as follows
    <word> <number of occurrences> <line numbers in the file where the word occurs>
    For example, if the word Hello occurs thrice in a file at lines 100, 178 and 3456 the output should read
    Hello, 3, [100, 178, 3456]

    Incidentally i wrote similar code some days back. You need to do some modifications to get the exact output you want, but i hope it will be of some help.
    One more thing its written using JAVA5
    public class Test
         private static final String COLLECTIONS_TEXT = "C:\\Documents and Settings\\amrainder\\Desktop\\Collections.txt";
         public static void main(String[] args) throws IOException
              findDuplicateWords();
         private static void findDuplicateWords() throws IOException
              Collection<String> words = new LinkedHashSet<String>();
              File file = new File(COLLECTIONS_TEXT);
              StreamTokenizer streamTokenizer = new StreamTokenizer(new FileReader(file));
              int token = streamTokenizer.nextToken();
              while(token != StreamTokenizer.TT_EOF)
                   if(token == StreamTokenizer.TT_WORD)
                        words.add(streamTokenizer.sval);
                   token = streamTokenizer.nextToken();
              System.out.println(words);
    }Cheers,
    Amrainder

  • DUMP: replace all occurrences of space in string1 with string2.

    Why does this statement results in a dump:
    replace all occurrences of space in string1 with string2.
    same with
    replace all occurrences of ' ' in string1 with string2.
    string2 is a string without spaces!
    Is there any drawback on using this statements as a workaround?
    while sy-subrc eq 0.
      replace space with string2 into string1.
    endwhile.
    Thanks
    norbert

    Hi,
    See this example i got from ABAPDOCU
    replacing values
    DATA: t4(10) TYPE c VALUE 'abcdefghij',
          string4 LIKE t4,
          str41(4) TYPE c VALUE 'cdef',
          str42(4) TYPE c VALUE 'klmn',
          str43(2) TYPE c VALUE 'kl',
          str44(6) TYPE c VALUE 'klmnop',
          len4 TYPE i VALUE 2.
    string4 = t4.
    WRITE string4.
    REPLACE str41 WITH str42 INTO string4.
    WRITE / string4.
    string4 = t4.
    REPLACE str41 WITH str42 INTO string4 LENGTH len4.
    WRITE / string4.
    string4 = t4.
    REPLACE str41 WITH str43 INTO string4.
    WRITE / string4.
    string4 = t4.
    REPLACE str41 WITH str44 INTO string4.
    WRITE / string4.
    SKIP.
    ULINE.
    Example for condensing strings
    DATA: string9(25) TYPE c VALUE ' one  two   three    four',
          len9 TYPE i.
    len9 = strlen( string9 ).
    WRITE: string9, '!'.
    WRITE: / 'Length: ', len9.
    CONDENSE string9.
    len9 = strlen( string9 ).
    WRITE: string9, '!'.
    WRITE: / 'Length: ', len9.
    CONDENSE string9 NO-GAPS.
    len9 = strlen( string9 ).
    WRITE: string9, '!'.
    WRITE: / 'Length: ', len9.
    SKIP.
    ULINE.
    Thanks & Regards,
    Judith.

  • Count occurrences of matched words

    All,
    Does anyone know the syntax or algorithm to count the occurrences of matched words that where compared from two separate columns or tables? Below is a simple example of the type of comparison I would like to perform. I found the function regexp_count, but it only works in 11g. Unfortunately, I have Oracle 10g. Any help would be greatly appreciated. Thanks
    i.e.
    drop table compare_matched_words;
    create table compare_matched_words (
    query_id number,
    query_string1 varchar2(80),
    query_string2 varchar2(80)
    insert into compare_matched_words values (1, 'oracle 255','oracle1 255');
    insert into compare_matched_words values (2, 'larry or ellison','larry or');
    insert into compare_matched_words values (3, 'oracle and text','and');
    insert into compare_matched_words values (4, 'market1 share','market share');
    insert into compare_matched_words values (5, 'larry or',' larry or ellison');
    insert into compare_matched_words values (6, 'oracle1 255','oracle 255');

    Issue is not in 11g. Before you can solve the task you need to split QUERY_STRING1 and QUERY_STRING2 into words and then compare words for same QUERY_ID. To split string into words use something like:
    select  query_id,
            regexp_substr(query_string1,'\w+',1,column_value) query_string1_word
      from  compare_matched_words t,
            table(
                  cast(
                       multiset(
                                select  level
                                  from  dual
                                  connect by level <= length(regexp_replace(regexp_replace(QUERY_STRING1,'\w+','A'),'[^A]'))
                               ) as sys.OdciNumberList
    SQL> /
               QUERY_ID QUERY_STRING1_WORD
                      1 oracle
                      1 255
                      2 larry
                      2 or
                      2 ellison
                      3 oracle
                      3 and
                      3 text
                      4 market1
                      4 share
                      5 larry
               QUERY_ID QUERY_STRING1_WORD
                      5 or
                      6 oracle1
                      6 255
    14 rows selected.
    SQL> Now:
    select  t1.query_id,
            t1.query_string1,
            t2.query_string2,
            count(*) matchin_word_count
      from  (
             select  query_id,
                     query_string1,
                     regexp_substr(query_string1,'\w+',1,column_value) query_string1_word
               from  compare_matched_words t,
                     table(
                           cast(
                                multiset(
                                         select  level
                                            from  dual
                                           connect by level <= length(regexp_replace(regexp_replace(query_string1,'\w+','A'),'[^A]'))
                                        ) as sys.OdciNumberList
            ) t1,
             select  query_id,
                     query_string2,
                     regexp_substr(query_string2,'\w+',1,column_value) query_string2_word
               from  compare_matched_words t,
                     table(
                           cast(
                                multiset(
                                         select  level
                                            from  dual
                                           connect by level <= length(regexp_replace(regexp_replace(query_string2,'\w+','A'),'[^A]'))
                                        ) as sys.OdciNumberList
            ) t2
      where t2.query_id = t1.query_id
        and t2.query_string2_word = t1.query_string1_word
      group by t1.query_id,
               t1.query_string1,
               t2.query_string2
      order by t1.query_id
               QUERY_ID QUERY_STRING1                  QUERY_STRING2                   MATCHIN_WORD_COUNT
                      1 oracle 255                     oracle1 255                                      1
                      2 larry or ellison               larry or                                         2
                      3 oracle and text                and                                              1
                      4 market1 share                  market share                                     1
                      5 larry or                        larry or ellison                                2
                      6 oracle1 255                    oracle 255                                       1
    6 rows selected.
    SQL> SY.

  • 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.

  • How to replace multiple occurences of space in a string to a single space?

    How to replace multiple occurences of space in a string to a single space?

    Hi,
    try this code.
    data : string1(50) type c,
              flag(1) type c,
              dummy(50) type c,
              i type i,
              len type i.
    string1 = 'HI  READ    THIS'.
    len = strlen( string1 ).
    do len times.
    if string1+i(1) = ' '.
    flag = 'X'.
    else.
    if flag = 'X'.
    concatenate dummy string1+i(1) into dummy separated by space.
    clear flag.
    else.
    concatenate dummy string1+i(1) into dummy.
    endif.
    endif.
    i = i + 1.
    enddo.
    write : / string1.
    write : / dummy.

  • Use Powershell to replace text with image in Word document

    I have a powershell script that uses a Word document as a template to create signatures that I am pushing out to my organization.
    The document is populated with text formatted the way I want the signature to look, that I then do a FindText and ReplaceText on.  This works fine for replacing text with text, but I can't figure out how to properly replace some of the holder text with
    an image and a link.  I found a few posts about adding images to word documents, but none that seem to work properly in this scenario.
    Any insight would be greatly appreciated, thanks!

    Dear BOFH,
    You are correct that method I outlined is not for inserting an image into a signature block (which would be in Outlook, not Word).  The links you post do certainly deal with outlook signatures, well done... Except that the question was about how to
    use a Powershell script to replace text in a Word document with an image.  Sure it was framed in the context of creating signatures, but the poster expressed that they already had a method of generating and replacing text, and just needed to know, as
    I did, how to do the thing they actually asked.
    Please BOFH... Please forgive my audacity in hoping to find a reference (any reference) to how to replace Word text with images via Powershell in a thread titled "Use Powershell to replace text with image in Word document".
    This is certainly a scripting question, and even something as simple as "You will need to call the .NET methods for the Word find/replace functionality.  Please ask in the Word forums for the correct method to use. 
    If you need help on calling .NET methods look HTTP ://here"support you offered combined with the contempt you offer in response to my actual substantive help to the actual question asked.
    BOFH, you are not better than us, just more arrogant.
    Can you please start your own question as this one has been closed.  Please see scripting guidelines.
    We cannot guarantee you satisfaction as this is a user supported forum.  The is no SLA for community support.  Perhaps if you posted a better worded question as a new topic someone might be able to help you resolve your issue.
    The topic you are posting on is closed and answered.
    ¯\_(ツ)_/¯

  • Finding Last occurance of a word to gather key information

    I am wondering how to find the last occurance of a word using coldfusion to gather the data i need. I am using some of the google maps XML code and the last occurance of distance gives the total distance which is what i need. How would I be able to find the last occurance and take the data from the code and place it in a template?

    <DirectionsResponse>
    <status>OK</status>

    <route>
    <summary>Hwy 7/Regional Road 7 E</summary>

    <leg>

    <step>
    <travel_mode>DRIVING</travel_mode>

    <start_location>
    <lat>43.8334600</lat>
    <lng>-79.4994300</lng>
    </start_location>

    <end_location>
    <lat>43.8210000</lat>
    <lng>-79.4994700</lng>
    </end_location>

    <polyline>
    <points>cfpjGlffdNvBc@vDB|@G`\oFtMaAfNyAjARl@d@Xb@l@~Bj@|E</points>
    <levels>B?????@????B</levels>
    </polyline>

    <duration>
    <value>110</value>
    <text>2 mins</text>
    </duration>

    <html_instructions>
    Head <b>south</b> on <b>Basaltic Rd</b> toward <b>Jacob Keffer Pkwy</b>
    </html_instructions>

    <distance>
    <value>1511</value>
    <text>1.5 km</text>
    </distance>
    </step>

    <step>
    <travel_mode>DRIVING</travel_mode>

    <start_location>
    <lat>43.8210000</lat>
    <lng>-79.4994700</lng>
    </start_location>

    <end_location>
    <lat>43.8196300</lat>
    <lng>-79.4989100</lng>
    </end_location>

    <polyline>
    <points>gxmjGtffdNpGoB</points>
    <levels>BB</levels>
    </polyline>

    <duration>
    <value>36</value>
    <text>1 min</text>
    </duration>
    <html_instructions>Turn <b>left</b> at <b>Planchet Rd</b></html_instructions>

    <distance>
    <value>158</value>
    <text>0.2 km</text>
    </distance>
    </step>

    <step>
    <travel_mode>DRIVING</travel_mode>

    <start_location>
    <lat>43.8196300</lat>
    <lng>-79.4989100</lng>
    </start_location>

    <end_location>
    <lat>43.8231600</lat>
    <lng>-79.4720400</lng>
    </end_location>

    <polyline>
    <points>uomjGdcfdNyRg{AwEq\]wDoC}QQqBF{CVyAp@qBvAcBdDoB</points>
    <levels>B????@??@?B</levels>
    </polyline>

    <duration>
    <value>241</value>
    <text>4 mins</text>
    </duration>
    <html_instructions>Turn <b>left</b> at <b>Langstaff Rd</b></html_instructions>

    <distance>
    <value>2333</value>
    <text>2.3 km</text>
    </distance>
    </step>

    <step>
    <travel_mode>DRIVING</travel_mode>

    <start_location>
    <lat>43.8231600</lat>
    <lng>-79.4720400</lng>
    </start_location>

    <end_location>
    <lat>43.8738800</lat>
    <lng>-79.2597800</lng>
    </end_location>

    <polyline>

    <points>
    wenjGf{`dN}UubAgH{WkAcFuAqHsBiPcCg^kAmL}LobAg@{CsAqE}@mBm@cAaGuHmBwCsAaDuAiFaFiZgBgMoA{KiA {MwAqUi@}MQiJG_GAs`@WeDg@uDai@{uDuLy{@iLi}@cJap@gCaPiFgUmAyGs`@wmCqJct@aQomA}@kFiCqRsB{M]i BOMkCaNmBaLi@uDDU]mCo@}DGAqCiRFK_BuKKE}Ism@WqAqAaEoDmI]uABO]}B
    </points>

    <levels>
    B???@????@?????@?@???@?????@???????????@??????????????@?????B
    </levels>
    </polyline>

    <duration>
    <value>1425</value>
    <text>24 mins</text>
    </duration>
    <html_instructions>Turn <b>left</b> at <b>Hwy 7/Regional Road 7 E</b></html_instructions>

    <distance>
    <value>18072</value>
    <text>18.1 km</text>
    </distance>
    </step>

    <step>
    <travel_mode>DRIVING</travel_mode>

    <start_location>
    <lat>43.8738800</lat>
    <lng>-79.2597800</lng>
    </start_location>

    <end_location>
    <lat>43.8812800</lat>
    <lng>-79.2615900</lng>
    </end_location>

    <polyline>
    <points>wbxjGrlwbNgBXGN{GfA{`@vF</points>
    <levels>B???B</levels>
    </polyline>

    <duration>
    <value>93</value>
    <text>2 mins</text>
    </duration>

    <html_instructions>
    Turn <b>left</b> at <b>Main St N/ON-48 N</b> (signs for <b>Sutton</b>)
    </html_instructions>

    <distance>
    <value>838</value>
    <text>0.8 km</text>
    </distance>
    </step>

    <step>
    <travel_mode>DRIVING</travel_mode>

    <start_location>
    <lat>43.8812800</lat>
    <lng>-79.2615900</lng>
    </start_location>

    <end_location>
    <lat>43.8829000</lat>
    <lng>-79.2506100</lng>
    </end_location>

    <polyline>
    <points>_qyjG|wwbN}A_L]iEy@eD{Es\Eu@DcBlAuH</points>
    <levels>B???@??B</levels>
    </polyline>

    <duration>
    <value>104</value>
    <text>2 mins</text>
    </duration>
    <html_instructions>Take the 3rd <b>right</b> onto <b>Parkway Ave</b></html_instructions>

    <distance>
    <value>924</value>
    <text>0.9 km</text>
    </distance>
    </step>

    <step>
    <travel_mode>DRIVING</travel_mode>

    <start_location>
    <lat>43.8829000</lat>
    <lng>-79.2506100</lng>
    </start_location>

    <end_location>
    <lat>43.8834200</lat>
    <lng>-79.2503400</lng>
    </end_location>

    <polyline>
    <points>c{yjGhsubNgBu@</points>
    <levels>BB</levels>
    </polyline>

    <duration>
    <value>27</value>
    <text>1 min</text>
    </duration>

    <html_instructions>
    Turn <b>left</b> at <b>Sir Constantine Dr</b><div style="font-size:0.9em">Destination will be on the right</div>
    </html_instructions>

    <distance>
    <value>62</value>
    <text>62 m</text>
    </distance>
    </step>

    <duration>
    <value>2036</value>
    <text>34 mins</text>
    </duration>

    <distance>
    <value>23898</value>
    <text>23.9 km</text>
    </distance>

    <start_location>
    <lat>43.8334600</lat>
    <lng>-79.4994300</lng>
    </start_location>

    <end_location>
    <lat>43.8834200</lat>
    <lng>-79.2503400</lng>
    </end_location>
    <start_address>Vaughan, ON, Canada</start_address>
    <end_address>Markham, ON, Canada</end_address>
    </leg>
    <copyrights>Map data ©2011 Google</copyrights>

    <overview_polyline>

    <points>
    cfpjGlffdNvBc@vDB|@G`\oFtMaApMyA|@Db@Ll@d@Xb@l@~Bj@|EpGoByRg{AwEq\]wDoC}QQqBF{CVyAp@qBvAcB dDoB}UubAgH{WkAcFuAqHsBiPcCg^kAmL}LobAg@{CsAqE}@mBm@cAaGuHmBwCsAaDuAiFaFiZgBgMuB_SkAiPy@cO _@yJQiJI{RDoNEgEWeDij@q{DuLy{@iLi}@cJap@gCaPiFgUmAyGs`@wmCqJct@aQomA}@kFiCqRsB{M]iBOMkCaNm BaLi@uDDU]mCo@}DGAqCiRFK_BuKKE}Ism@WqAqAaEoDmI]uABO]}BgBXGN{GfA{`@vF}A_L]iEy@eD{Es\Eu@DcBl AuHgBu@
    </points>

    <levels>
    B?????@???@?@A????@??@?A???@????@?????@?@???@?????@???@??????????????????????@?????@???@?? ?????B
    </levels>
    </overview_polyline>

    <bounds>

    <southwest>
    <lat>43.8196300</lat>
    <lng>-79.4994700</lng>
    </southwest>

    <northeast>
    <lat>43.8834200</lat>
    <lng>-79.2503400</lng>
    </northeast>
    </bounds>
    </route>
    </DirectionsResponse>
    Here is the code, the last <distance> tag contains the total distance of the trip which is the only thing I am interested in.

Maybe you are looking for

  • Hard Drive I/O Errors

    Hi, I've bought a new iMac G5 2.0 17" about two months ago. It worked fine for the first month and then started to hangup randomly for a few minutes. I can move the mouse cursor but it shows the spinning "beachball" but the computer stays frozen .. A

  • APP - Proposal Run

    Hi Experts, This is relating to error message at proposal run. In F110 after entered payment paratmeters in the second step i am getting payment proposal has been released. After this i am not getting any buttons like edit proposal, payment run are n

  • Why do 2 firefox windows open every time a click on an email i outlook 2010?

    I am running firefox and outlook 2010. When I click onan email in outlook, two firefox windows open, with address to local temp files on my c drive. How can I get this to stop?

  • Can't install iTunes on new notebook with windows 8.1

    First, sorry for my bad english, i hope you can understand what i am trying to say. I got a new notebook and wanted to install iTunes. First it worked but then i needed to do a system restore because of a virus. So iTunes was no longer on my notebook

  • Error when calling getLocalSocketAddress() on for a newly created socket

    Hello, I have an issue when using JVM 1.5.0.12 on HP-UX (IA64N): java.lang.Error: java.net.SocketException: Bad file number (errno:9)      at sun.nio.ch.Net.localAddress(Net.java:123)      at sun.nio.ch.SocketChannelImpl.localAddress(SocketChannelImp