.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 16th, 2012, 02:37 PM
MRb1980 MRb1980 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2010
Posts: 84 MRb1980 User rank is Corporal (100 - 500 Reputation Level)MRb1980 User rank is Corporal (100 - 500 Reputation Level)MRb1980 User rank is Corporal (100 - 500 Reputation Level)MRb1980 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 12 m 16 sec
Reputation Power: 4
Can someone tell me if there is already a funciton for this?

Hey there people,

I have a file in this format:-

FIRST_VALUE, This is a value
SECOND_VALUE, This is another value
THIRD_VALUE, This is also a value

I use a function to read this data into an array which ends up like this:-

first_array(0) = "FIRST_VALUE, This is a value"
first_array(1) = "SECOND_VALUE, This is another value"

How the heck do I take that array an split it down the middle so that I have something like this:-

first_array(0) = "FIRST_VALUE"
second_array(0) = "This is a value"

etc, etc.

Any ideas?

Cheers
MRb

Reply With Quote
  #2  
Old January 20th, 2012, 03:35 AM
petesc petesc is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2012
Posts: 1 petesc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 34 sec
Reputation Power: 0
To me that sounds like a problem for the RegEx-Namespace (regular Expressions). Although I am currently not too familiar with that this sounds as if you just need to search for the x-th occurence of a sequence of letters, starting with a capital one and terminated by a "," and put each into the (x-1)-th position inside your array.
Maybe you can also work with string.IndexAt(string s) to search for the "," and "\n" symbols and cut of, what you don't need with string.trim().
At least the first option will work fine, although it might be a little bit more complicated than using the options of the string-class.

Best regards!

Reply With Quote
  #3  
Old January 21st, 2012, 04:08 PM
MRb1980 MRb1980 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2010
Posts: 84 MRb1980 User rank is Corporal (100 - 500 Reputation Level)MRb1980 User rank is Corporal (100 - 500 Reputation Level)MRb1980 User rank is Corporal (100 - 500 Reputation Level)MRb1980 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 12 m 16 sec
Reputation Power: 4
Thank you for your reply, I'll report back on how I solved this one when I do.

Cheers,
MRb

Reply With Quote
  #4  
Old February 14th, 2012, 03:18 PM
bunker17 bunker17 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 144 bunker17 User rank is Sergeant (500 - 2000 Reputation Level)bunker17 User rank is Sergeant (500 - 2000 Reputation Level)bunker17 User rank is Sergeant (500 - 2000 Reputation Level)bunker17 User rank is Sergeant (500 - 2000 Reputation Level)bunker17 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 7 h 7 m 25 sec
Reputation Power: 16
Read You file usinf .ReadLine() then on the returning string call string.split(",") you will get an array with two elements with each of the elements.
__________________
My blog

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Can someone tell me if there is already a funciton for this?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap