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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

count a string

Status
Not open for further replies.

newprog42

Technical User
Aug 25, 2019
1
DZ
hi all:

I want to count a word in a text file by using as condition the last character and put result into 3 edittext .

if I have for example the word MACNAME(X or Y or Z) which will be parsed from text file .

MACNAMEX

MACNAMEY

MACNAMEZ

the last character is X & Y & Z .

put the result in jedittext :

e1.gettext('count of number of MACNAMEX' );// here is 1
e2.gettext('count of number of MACNAMEY' );// here is 1
e3.gettext('count of number of MACNAMEZ' );// here is 1



I 'm doing GUI application which import text file and count a word by using regx.

I have used scanner method to import text

try (Scanner sc = new Scanner(new File("C:\\MAC.txt"))) {

the REGX used is:

private static String REG ="((?<MACNAME>\\w+)";

how to do that ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top