473,387 Members | 1,529 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

max number of consecutive dot in a text file ?

2
I have a text file : electron.txt
I want to count the max number of consecutive dots "." in the above text file,

dot is not a character, how to parse the line string returned from the text file to count dots. ?


please your help is appreciated.
Thanks
Oct 1 '13 #1
2 1589
stdq
94 64KB
Hi, mlotfi. I believe '.' is, or at least can be viewed as, a character. You can access a character at a specified position in a String using the method charAt on the String, sending to the method as an argument the position you want in the String. Some info about this method can be found here: http://docs.oracle.com/javase/6/docs...ng/String.html
Oct 1 '13 #2
r035198x
13,262 8TB
What do you mean by max number of consecutive dots? Do you just mean number of consecutive dots (without the max part)?
If a line contains .... is that counted as one occurrence of consecutive dots or three occurrences ([..]..) , (.[..].), (..[..])?

Depending on what is you are actually looking for, you could use a regex expression for the matching, e.g
Expand|Select|Wrap|Line Numbers
  1.  final Pattern p = Pattern.compile("(\\.{2,})");
  2.         final Matcher matcher = p.matcher("...asd.f.....ee.fgfgf");
  3.         while (matcher.find()) {
  4.             System.out.println("found: " + matcher.group(1));
  5.         }
  6.  
Oct 3 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Noam Dekers | last post by:
Hi all, I would like to find a word stored in a text file. Structure: I have one file named keyWords.txt that stores some key words I'm interested in finding. In addition I also have a file...
1
by: Gema Gema | last post by:
I have a large collection of directories full of various files and am looking to create custom text files for the contents of each directory. Here is the situation: The directories are named...
1
by: dmiller23462 | last post by:
Hi again guys.... This is my first source of help, by far the best ASP intellectual collective....Thanks in advance for any assistance...Anyway.... The forms I'm still working on (finishing...
1
by: wtnt | last post by:
Hello. I've searched all over and haven't seen another thread with this problem. Please bear with me as I try to explain. thanks. :) I have some programs that need to be cross-platform...
1
by: Dixie | last post by:
I have a copy of a tab delimited text file that was created from an excel spreadsheet. I want to try to emulate this text file using Access 2000. I don't have access to the spreadsheet, but do...
6
by: ivan.perak | last post by:
Hello, im a beginner in VB.NET... The thing i would like to do is as it follows.... I have a text file (list of names, every name to the next line) which is about 350000 lines long. I would...
5
by: Johnymap | last post by:
Hi everyone I have text file which looks like these: "index.txt" Johan 22 sebaya "home.hml" Mpho 23 leboa "index.frt" Tedesca 24 teba My problem is i want to read the number on the last...
1
by: CAM123 | last post by:
I have added: <br><xsl:value-of select="Line" /></br> to my XSLT stylesheet to get a line per repeating block. When I view the output as XML it looks perfect - one line per block. However...
7
by: kashif73 | last post by:
I have a text file , from which I read a single line & display it in my form. How can I read the line number for that particular line, which is being displayed in my form?? Thanks.
4
by: lightning18 | last post by:
I have a list of incorrect words called # words and another list containing my txt file # text. I want to print the line number of the words located in the text. I get the following error for my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.