Im using an API call to populate some fields on my website. These fields are populated with different parts of an address. However, in my first address line field the value is abbreviated. For example, if i had 'Smith Street' it would get inserted as 'Smith St'. To get around this issue i am using javascript to replace the value, for example:
value = value.replace("St", "Street");
However if i then have, for example, a value that is 'Stanley Street' it would return 'Streetanley Street'.
Does anybody know of a method i can use to apply the replace method to the last word in a string?