Hi.

I would like to use vbscript to reformat text in a musiclibrary.

All performers are located in a textfile like this:

Line 1: ADAMS, BRYAN (ENG) + DENVER, JOHN (USA) + JARRE, JEAN MICHELLE (FRA)
+ THE BEATLES + THE DOORS

I want to acchive a swithching of lastname, firstname so result being like
the following :
(If possible change the letters to capital exept for
the first letter. The language code ex. (ENG) should be kept in capital.)

Bryan Adams (ENG) + John Denver (USA) + Jean Michelle Jarre (FRA) + The
Beatles + The Doors

Is there an expert who knows the answer in this case ?

\T. Tei

Re: Reformatting text.... by McKirahan

McKirahan
Fri Sep 15 14:20:15 CDT 2006

"Titten Tei" <tei@tei.no> wrote in message
news:450ae882$1@news.broadpark.no...
> Hi.
>
> I would like to use vbscript to reformat text in a musiclibrary.
>
> All performers are located in a textfile like this:
>
> Line 1: ADAMS, BRYAN (ENG) + DENVER, JOHN (USA) + JARRE, JEAN MICHELLE
(FRA)
> + THE BEATLES + THE DOORS
>
> I want to acchive a swithching of lastname, firstname so result being like
> the following :
> (If possible change the letters to capital exept for
> the first letter. The language code ex. (ENG) should be kept in capital.)
>
> Bryan Adams (ENG) + John Denver (USA) + Jean Michelle Jarre (FRA) + The
> Beatles + The Doors
>
> Is there an expert who knows the answer in this case ?

Something like this:

a) Read a line
b) Split on "+" and process each entry; (steps c - e).
c) If there's a comma then switch last and first names and remove comma.
d) Convert case of all letters (except the first) to lowercase.
e) Leave characters inside parentheses untouched.
f) Join the entries with a "+".
g) Write the line.

So my name would be changed to "Mckirahan" (not "McKirahan")?!

1) Use the FileSystemObject to read and write.
2) Look at Split() and Join() to work with the entries
3) Look at LCase() to convert to lowercase
4) Look at Mid() to keep the first character uppercase