473,788 Members | 2,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

split data

I'm new to the C# world and learning as I go.
I have a question, I'm getting data back from my database such as

name/region.

How can I split this and only return the region?

Nov 15 '05 #1
5 2934
In article <#s************ **@TK2MSFTNGP10 .phx.gbl>,
cs*********@sbc global.net says...
I'm new to the C# world and learning as I go.
I have a question, I'm getting data back from my database such as

name/region.

How can I split this and only return the region?

If it is a string I.e. "John Doe/New York" you can use
string[] splitString = nameRegion.Spli t('/');

then you can access name using splitString[0] and [1] for the region.

--
Thanks
Mark mm
Nov 15 '05 #2
heres what i have and its not working, i'm a missing something or is the
syntax incorrect?

String User = request.Serverv ariables["AUTH_USER"];
string[] splitString = User.Split('/');
lblUser.text = User[2];

2 should be the user name only

"Mark mm" <ma********@hot mail.com> wrote in message
news:MP******** *************** *@News.CIS.DFN. DE...
In article <#s************ **@TK2MSFTNGP10 .phx.gbl>,
cs*********@sbc global.net says...
I'm new to the C# world and learning as I go.
I have a question, I'm getting data back from my database such as

name/region.

How can I split this and only return the region?

If it is a string I.e. "John Doe/New York" you can use
string[] splitString = nameRegion.Spli t('/');

then you can access name using splitString[0] and [1] for the region.

--
Thanks
Mark mm

Nov 15 '05 #3
In article <#N************ **@TK2MSFTNGP10 .phx.gbl>,
cs*********@sbc global.net says...
heres what i have and its not working, i'm a missing something or is the
syntax incorrect?

String User = request.Serverv ariables["AUTH_USER"];
string[] splitString = User.Split('/');
lblUser.text = User[2];

2 should be the user name only

Remember arrays are 0 indexed ie the second element will be 1.
If you put a break point at the lblUser.. statement and look at what
splitString contains it may reveal more.

--
Thanks
Mark mm
Nov 15 '05 #4
its actually blowing up on this \ when i try to split the string
it should be

String User = request.Serverv ariables["AUTH_USER"];
string[] splitString = User.Split('\') ; 'receiving error here when
compiling.
lblUser.text = User[2];

does C# not like the backslash? \

"Mark mm" <ma********@hot mail.com> wrote in message
news:MP******** *************** *@News.CIS.DFN. DE...
In article <#N************ **@TK2MSFTNGP10 .phx.gbl>,
cs*********@sbc global.net says...
heres what i have and its not working, i'm a missing something or is the
syntax incorrect?

String User = request.Serverv ariables["AUTH_USER"];
string[] splitString = User.Split('/');
lblUser.text = User[2];

2 should be the user name only

Remember arrays are 0 indexed ie the second element will be 1.
If you put a break point at the lblUser.. statement and look at what
splitString contains it may reveal more.

--
Thanks
Mark mm

Nov 15 '05 #5
i got it working now
"Mike" <cs*********@sb cglobal.net> wrote in message
news:eE******** *****@TK2MSFTNG P11.phx.gbl...
its actually blowing up on this \ when i try to split the string
it should be

String User = request.Serverv ariables["AUTH_USER"];
string[] splitString = User.Split('\') ; 'receiving error here when
compiling.
lblUser.text = User[2];

does C# not like the backslash? \

"Mark mm" <ma********@hot mail.com> wrote in message
news:MP******** *************** *@News.CIS.DFN. DE...
In article <#N************ **@TK2MSFTNGP10 .phx.gbl>,
cs*********@sbc global.net says...
heres what i have and its not working, i'm a missing something or is the syntax incorrect?

String User = request.Serverv ariables["AUTH_USER"];
string[] splitString = User.Split('/');
lblUser.text = User[2];

2 should be the user name only

Remember arrays are 0 indexed ie the second element will be 1.
If you put a break point at the lblUser.. statement and look at what
splitString contains it may reveal more.

--
Thanks
Mark mm


Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
12843
by: SL_McManus | last post by:
Hi All; I am fairly new to Perl. I have a file with close to 3000 lines that I would like to split out in a certain way. I would like to put the record type starting in column 1 for 2 spaces, the employer code in column 23 for 29 spaces and employer description in column 53 for 30 spaces. I have tried modifying an existing file with no real success. I haven't found anything that specifically answers my question. Any guidance would be...
0
4256
by: j | last post by:
Hi, Anyone out there with binary search tree experience. Working on a project due tomorrow and really stuck. We need a function that splits a binary tree into a bigger one and smaller one(for a random binary search tree. We've tried everything but are in the land of pointer hell. If someone could help it would be a huge help. our code follows. We've tried 2 diff methods the split() and splitter() functions #include <iostream> #include...
4
3607
by: Brian Glen Palicia | last post by:
My goal is to accept input from the user into a text box and then parse the data using split(). The first step is this tiny program to test the split() function. It runs in IE, but in Mozilla it just hangs and keeps loading forever. I checked around on the web and in USENET, but I haven't seen any mention of split() not working in Mozilla. Thoughts? Thanks in advance. <HTML> <HEAD> </HEAD>
1
2271
by: rcmail14872 | last post by:
I have a standard Access database with standard Forms and it is not split. I am going to run the upsizing wizard to change the data tables to SQL. I also need to split the database and I am going to change the Forms to be Data Access Pages so that records can be added and edited through Internet Explorer. What order should I take these steps? Can I just save the forms as Data Access Pages and they will work? I think maybe I should get...
19
10923
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.
3
3234
by: Jan Hanssen | last post by:
Hi! I have a list of data in a textfile which is tab delimited. Each line is seperated by a VbCrLf. I want to collect this data in a multidimensional string array. I do not wish to use a database or a Disconnected ADO Recordset since this is just passing data along to be written into an XML file... I've figured out how to split the data line by line by doing a
14
34977
by: Ron | last post by:
Hello, I am trying to parse a string on the newline char. I guess vbCrLf is a string constant. How can I parse my string - data - on the newline char? .... data += ASCII.GetString(buffer, 0, bytesRead) .... Dim parts() As String = data.Split(vbCrLf)
9
2198
by: MrHelpMe | last post by:
Hello again experts, I have successfully pulled data from an LDAP server and now what I want to do is drop the data into a database table. The following is my code that will insert the data but that has problems. FullName=Request.Form("Name") Email=Request.Form("Email") GivenName=Request.Form("GivenName")
11
5086
by: Brian | last post by:
I have been working on a data reception system.. I am still finding my way around Javascript, though I am accomplishing much. I just fixed a flaw that was really hard to find. The symptoms are this: I get a multiline string returned to Javascript from a Proxy+Google Maps API GDownloadUrl() The data, when added to a DOM table looked fine, about 20 lines in CSV format
1
8377
Atli
by: Atli | last post by:
The following small HowTo is a compilation of an original problem in getting some cookie-values through different methods of string-handling. The original Problem was posted as follows: As you can see, there could have been a problem with the split-method. The following short article handles ways around this possible problem, that we couldn't reproduce, but someone may possibly encounter it too sometimes. If nothing else, the shown...
0
9498
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,...
0
10373
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8995
agi2029
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...
1
7519
isladogs
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...
0
6750
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();...
1
4074
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
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2897
bsmnconsultancy
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...

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.