simple basic use

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
User avatar
Nicholas Jordan
Posts: 124
Joined: Mon Dec 20, 2004 12:33 am
Location: Central Texas ISO Latin-1
Contact:

simple basic use

Post by Nicholas Jordan »

I need get-going help to replace nearly 300 lines like this:

Code: Select all

String Tokelau ="Overseas territory of New Zealand";//
With this:
*

Code: Select all

super.put(new String ("Tokelau"),new String("Overseas territory of New Zealand"));//
Or something close to that, this is tedious to do by hand.

I have tried thusfar to try to get going:

Code: Select all

String [[:alpha:]]+

Code: Select all

\(String\) [[:alpha:]]+

Code: Select all

\\(String\\) [[:alpha:]]+
First form produces a find, I was trying to do capturing groups from Wiki description of regex. Am not making any progress, there may be one or two rounds to get me going. Spaces outside of quoted strings do not matter except between new and String
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

replace

Code: Select all

String[ \t]+([^ \t]+).*"(.*)".*
by

Code: Select all

super.put(new String("\1"), new String("\2"));
Btw, are you sure you want to have new String("bla") instead of just "bla"? In Java (and your sample looks like Java) it is not necessary.
User avatar
Nicholas Jordan
Posts: 124
Joined: Mon Dec 20, 2004 12:33 am
Location: Central Texas ISO Latin-1
Contact:

making a TreeMap of Country Names / Longer String

Post by Nicholas Jordan »

MudGuard wrote:.....Btw, are you sure you want to have new String("bla") instead of just "bla"? In Java (and your sample looks like Java) it is not necessary.
Will try your code momentarily, client wants to see what I have recently.

{ message edit: it worked! }

Code: Select all

     super.put(new String("Tuvalu"), new String("Ellice Islands"));// 

What this is:

Writing Java, a plug-in for a server written almost entirely in Java running well designed apps that talk to client written in Java. All looks really nice and is well done work. Spec list includes providing dropdown list of country names for end-use html so that average customer may select what country from in html writtten to browser.

I already had list of String / country prototyped in Java, had previously setteled on the design of making class a TreeMap (extends TreeMap) Thus, in the constructor I can do super.put( new String, new String ); and have the list of country names available as an enumeration of keys. This would be handy since the entire environment is totally Java anyway: I could just do PageBuffer.append() html select and feed it the Enumeration as however you get Strings back out of an Enumeration,....First I needed to get the sources into shape.
Post Reply