S
Slonocode
Hello I am trying to display a USA address properly in a multiline textbox.
Unfortunately the address I must process is contained in a string variable
and the format is not uniform.
Examples:
John Smith, 12345 Main Street, Anytown, NY 98776
John Smith, 12345 Main Street, Anytown, NY, 98876
John Smith, c/o Jane Smith, 12345 Main Street, Anytown, NY 98876
John Smith, c/o Jane Smith, 12345 Main Street, Anytown, NY, 98876
As you may notice some have a comma after the state and some don't.
Also there are a variable number of commas before the comma between the city
and state.
The problem is that the original program that stores the address puts a
comma wherever there is a newline character in the address. Unfortunately I
have no control over how the addresses are saved by the original program so
I have to deal with this mess.
My problem is that I can't seem to isolate the comma between the city and
state. That comma obviously needs to remain while the rest need to be
replaced with newline characters.
Any ideas how I might attack this?
Unfortunately the address I must process is contained in a string variable
and the format is not uniform.
Examples:
John Smith, 12345 Main Street, Anytown, NY 98776
John Smith, 12345 Main Street, Anytown, NY, 98876
John Smith, c/o Jane Smith, 12345 Main Street, Anytown, NY 98876
John Smith, c/o Jane Smith, 12345 Main Street, Anytown, NY, 98876
As you may notice some have a comma after the state and some don't.
Also there are a variable number of commas before the comma between the city
and state.
The problem is that the original program that stores the address puts a
comma wherever there is a newline character in the address. Unfortunately I
have no control over how the addresses are saved by the original program so
I have to deal with this mess.
My problem is that I can't seem to isolate the comma between the city and
state. That comma obviously needs to remain while the rest need to be
replaced with newline characters.
Any ideas how I might attack this?