Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Replacing a part of the string

    Hello,

    I have a variable indicating state of residence. I want to replace And with & when it appears in the middle, for instance, Jammu And Kashmir, Daman And Diu. But when I run

    Code:
    replace state = subinstr(state,"And","&",.)
    , it replaces And in other positions as well. For instance, Andhra Pradesh becomes &hra Pradesh. How can I replace just the middle part?

    Thank you.

  • #2
    try putting spaces around it

    " And "

    but add spaces to " & " to put them back

    Comment


    • #3
      Thanks George. It works.

      Comment

      Working...
      X