hi all..
i have the following string:
200850625~01~46 4~^^200850625~0 1~464~^^2008506 25~01~908~^^
which i will need to turn to a mutli-dimentional string array
i used result.Split(ne w char[]{'^','^'}) for the rows
but for some reason i get an empty cell between each result, this is
also in the documentation, i just don't know why? 2 2017
Hi,
It does perfectly sense, The interpretation of the separators is of a OR ,
not a AND , it means that you are saying split by '^' or '^' it see two
together and it interprete it as an empty string ( or an empty field )
Can you in any way get rid of the double ^^ and replace them by a single
one?
ITOH it does not matter in the end, you just check for an empty string and
continue if so:
string[] parts1 = result.Split(ne w char[]{'^','^'}) ;
foreach( string s in parts1)
if ( s.Length>0 )
{
string[] parts2 = s.Split( new char[] {'~'} );
//do the work
}
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Elhanan" <em*****@hotmai l.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. . hi all..
i have the following string: 200850625~01~46 4~^^200850625~0 1~464~^^2008506 25~01~908~^^
which i will need to turn to a mutli-dimentional string array
i used result.Split(ne w char[]{'^','^'}) for the rows but for some reason i get an empty cell between each result, this is also in the documentation, i just don't know why?
Elhanan,
In addition to the other comments on Split, there are three Split functions
in .NET:
Use Microsoft.Visua lBasic.Strings. Split if you need to split a string based
on a specific word (string). It is the Split function from VB6.
Use System.String.S plit if you need to split a string based on a collection
of specific characters. Each individual character is its own delimiter.
Use System.Text.Reg ularExpressions .RegEx.Split to split based
on matching patterns.
NOTE: VS.NET 2005 (.NET 2.0) adds an overload to String.Split for String
delimiters: http://msdn2.microsoft.com/library/t...us,vs.80).aspx
Hope this helps
Jay
"Elhanan" <em*****@hotmai l.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
| hi all..
|
| i have the following string:
| 200850625~01~46 4~^^200850625~0 1~464~^^2008506 25~01~908~^^
|
| which i will need to turn to a mutli-dimentional string array
|
| i used result.Split(ne w char[]{'^','^'}) for the rows
| but for some reason i get an empty cell between each result, this is
| also in the documentation, i just don't know why?
| This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Willem |
last post by:
Hello
I am quite hopeless and of course a newbe.
The situation: Sql2k / query
I would like it ot break down the following string:
2004 Inventory:Ex.Plant Farm1:1st Cut:Premium:0094
|
by: andrewcw |
last post by:
The split function takes as a parameter what I understand
as array of Char.
I can define the delimiter like this:
string innerText = new string;
char chSplit={'='};
innerText=tempText.Split(chSplit);
But if I try this ( to make the delimiter a variable ):
|
by: Senthil |
last post by:
Code
----------------------
string Line = "\"A\",\"B\",\"C\",\"D\"";
string Line2 = Line.Replace("\",\"","\"\",\"\"");
string CSVColumns = Line2.Split("\",\"".ToCharArray());
|
by: David Logan |
last post by:
We need an additional function in the String class. We need the ability
to suppress empty fields, so that we can more effectively parse. Right
now, multiple whitespace characters create multiple empty strings in the
resulting string array.
|
by: mb |
last post by:
I was wondering if there is an easy, more useful Split function that will
split with a string delimiter like "<>" or "////"?
| |
by: Rico |
last post by:
If there are consecutive occurrences of characters from the given
delimiter, String.Split() and Regex.Split() produce an empty string as the
token that's between such consecutive occurrences. It sounds like making
sense, but has anyone ever found this useful? Can this 'feature' be
disabled?
After having used StringTokenizer from the J-language that's not to be
named, it's annoyed me for hours before I figured out that it was just a...
|
by: kurt sune |
last post by:
The code:
Dim aLine As String = "cat" & vbNewLine & "dog" & vbNewLine & "fox" &
vbNewLine
Dim csvColumns1 As String() = aLine.Split(vbNewLine, vbCr, vbLf)
Dim csvColumns2 As String() = Microsoft.VisualBasic.Strings.Split(aLine,
vbNewLine, -1, CompareMethod.Binary)
|
by: Michele Petrazzo |
last post by:
Hello ng,
I don't understand why split (string split) doesn't work with the same
method if I can't pass values or if I pass a whitespace value:
>>> "".split()
>>> "".split(" ")
But into the doc I see:
|
by: martinskou |
last post by:
Hi, I'm looking for something like:
multi_split( 'a:=b+c' , )
returning:
whats the python way to achieve this, preferably without regexp?
Thanks.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |