Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Manipulation Question 1

Status
Not open for further replies.

DodgyDavid

Programmer
Nov 28, 2010
3
GB
Hi there,

I have what is probably a very simple query but one that I am banging my head on the desk solving.

The string that I am working with contains conjoined data and thus it might appear as...

Vuong Huu TanLe Van HongNguyen Hoang AnhNguyen Trong TrangDang Thi HongVietnam

I have used the following to identify strings that contain conjoined data...

if ($ZA_dbf =~ /[a-z][A-Z]/) {
print STDERR "Conjoined Data Found!\n"
}

What I need to do is to locate the string and insert a semi-colon space every time a join is found, thus...

Vuong Huu Tan; Le Van Hong; Nguyen Hoang Anh; Nguyen Trong Trang; Dang Thi Hong; Vietnam

I appreciate that this will require a loop to iterate over the data and search for the correct combination but I am scratching my head for a simple solution because this just sounds like I am over-complicating the issue.

Like they say in the books - if you are iterating character by character, then there's probably a much easier way to do it.

Many thanks for reading and if possible I would appreciate answers with code examples so that I can adapt as necessary.

David
 
Hi Franco,

Many thanks - Doesn't have to be that safe for this purpose as the join only exists in poor quality legacy data and a simple separation does the trick.

This is indeed just what I needed and I feel completely stupid for missing the obvious.

Much kudos to you my friend!

David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top