how to find a specific character in a txt file in c#
nikiki
0
Newbie Poster
Recommended Answers
Jump to PostHave a look at the code below, and see if that works for you, and if not, let us know why. Thanks and good luck.
using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { makeTexfile(); Boolean ok …
Jump to PostPerplexedB: You can't do the following:
int positionSeparator = line.IndexOf("-"); if (line.Substring(0,positionSeparator) == name ) {
It will throw an exception for any line that doesn't contain a "-".
positionSeparator = -1
when a line doesn't contain a "-".line.Substring(0,-1)
will throw an exception.See …
All 8 Replies
nikiki
0
Newbie Poster
PerplexedB
2
Newbie Poster
nikiki
0
Newbie Poster
nikiki
0
Newbie Poster
nikiki
0
Newbie Poster
nikiki
0
Newbie Poster
cgeier
187
Junior Poster
PerplexedB
2
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.