473,320 Members | 2,071 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,320 software developers and data experts.

how to find a pattern from astring using arraylist

Hi friends i want to search a pattern of digits from a string and i am using arraylist can you plz help me my code is like this:
Expand|Select|Wrap|Line Numbers
  1.  
  2.             StreamReader sr = new StreamReader(@"C:\Documents and Settings\jitendra\Desktop\RIC_SELL_080318.csv");
  3.  
  4.             StreamReader sr1 = new StreamReader(@"C:\Documents and Settings\jitendra\Desktop\RIC_customer_20080318.csv");
  5.  
  6.             StreamWriter sw = new StreamWriter(@"C:\strings.txt");
  7.  
  8.             string strline = "";
  9.             string strline1 = "";
  10.  
  11.             string[] values = null;
  12.             string[] _values = null;
  13.  
  14.             while (!sr.EndOfStream && !sr1.EndOfStream)
  15.             {
  16.                    strline = sr.ReadLine();
  17.                   strline1 = sr1.ReadLine();
  18.  
  19.                    values = strline.Split(',');
  20.                   _values = strline1.Split(',');
  21.  
  22.                   if (values.Length > 3 && values[2].StartsWith("52777") && (_values.Length >3 && _values[2].StartsWith("5212")))
  23.                   { 
  24.  
  25.                           sw.WriteLine(strline.ToString() + "\t\t" + strline1.ToString());
  26.  
  27.                   }
  28.             }
  29.             sw.Flush(); 
  30.             sw.Close();
  31.             sr.Close(); sr1.Close();
  32.         }
  33.  
  34.  
i want to search that the _index[2]. records if begins with the specified digit then
only it should read the string otherwise read the another string.
Mar 31 '08 #1
1 856
r035198x
13,262 8TB
What happens when you run your code then?
Mar 31 '08 #2

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

Similar topics

11
by: Michael G | last post by:
I want to use a factory pattern to create a variety of objects. Which object gets created depends on a string that is passed to the factory create method. I would like to avoid using an if or...
4
by: Arjen | last post by:
Hi, I have a class with some attributes. For example class person with name as attribute. I have add multiple persons in an arraylist. Now I need a function to get/find a person by the name...
12
by: Rubbrecht Philippe | last post by:
Hi there, According to documentation I read the ArrayList.IndexOf method uses the Object.Equals method to loop through the items in its list and locate the first index of an item that returns...
2
by: engelit.junk | last post by:
Hi, If you look at TreeNodeCollection.Find Method, you'll see: Finds the tree nodes with specified key, optionally searching subnodes. public TreeNode Find ( string key, bool...
14
by: micklee74 | last post by:
hi say i have string like this astring = 'abcd efgd 1234 fsdf gfds abcde 1234' if i want to find which postion is 1234, how can i achieve this...? i want to use index() but it only give me the...
14
by: dave.dolan | last post by:
Basically I'd like to implement the composite design pattern with leaves that are either of reference or value types, but even using generics I can't seem to avoid boxing (using ArrayList or...
12
by: Adrian | last post by:
The code below was taken from an example. All the "noise" in the example was thrown out. This is supposedly according to the bridge pattern. What in the code (which lines) represent the bridge...
1
by: RedLars | last post by:
Hi, Given this class definition, public class Node { Node parent; object current; ArrayList children;
11
by: digz | last post by:
Hello, Apologies if this is the wrong group for this question. I want to design an interface , where for a custom functionality , the client writes a new class with the function implementation...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.