.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Output Split string

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :


i need to split a string like so:


select name, goals from goals


nani 12,45,2

tevez  23,45,67

rooney 2

Need the output to be like


nani 12

nani 45

nani 2

tevez 23

tevez 45

tevez  67

rooney 2


Any ideas? thanks



View Complete Post

More Related Resource Links

string.Split - not all characters allowed as separator



I am working on a site where I use the Split function on a string.

To make sure I used a separator character that I do not use anywhere in the data I selected the character '£'.

This worked fine in Firefox and Safari, but in IE8 I get an 'Index out of range' error, so apparently the '£' character is not handled correctly.

I changed the separator to ';', and then it works fine.



How to split string?


I have a string that looks like this: pic1*pic2*pic3*

I want to take out every pic from the string like this:


I got the first pic but how do i get the other two?

Dim line as string = "pic1*pic2*pic3*"
Dim pic1 As String
Dim pic2 As String
Dim pic3 As String

pic1 = line.Substring(0, line.IndexOf("*"))
pic2 = ?
pic3 = ?

Split string using Regex with escape sequences

What is the regex to split a string using the delimiter ';', but not split on '\;' ? Backslash would be my escape character in my split string, so finding '\;' would not split, but '\\;' would split. For example I want a regex that would split the following:     "aaa;bb;cccc\;dd\;eee\\;ff\\;ggg\\\;hhh" into the following string array:     aaa     bb     ccc\;dd\;eee\\     ff\\     ggg\\\;hhh   Thanks!   -Sylvain

How to split the string value ?

 Hi I  have a string value ie) = '1001010' I want to split one word by one word. like  as 1 0 0 1 0 please guide me.  

Showing positive/negative sign in the output of Int32.ToString(string)

Hi,   Now this may be really simple but I'm unable to make it work or find it in MSDN. What is the format specifier for showing +/- sign of an Int32? I have tried "+0", "-0" and "+-0" and all of them give wrong results for either positive or negative or both kind of values. Note: The specifier should return "+0" for 0.

Split a String from a listbox to enter data in a table


Currently, I have a listbox that the selected items are inserted into the database by a string. Now I need to add a new feature that the searches are suppose to be postback individually so the selected values from the listbox need to be inserted into the database individually so the search can work. Is it possible to split an string into separate variables or into an array?

Thanks for your help,



Following is my store procedure and my back code:

<script runat="server">
    Protected Sub insertcompanydata_click1(ByVal sender As Object, ByVal e As EventArgs)

        Dim tobresults2 As String        
        Dim li As ListItem
        Dim myArrayList As ArrayList = New ArrayList()
        Dim strarr() As String
        For Each li In txttoblb.Items
            If li.Selected = True Then
            End If

        strarr = myArrayList.ToArray(Type.GetType("System.String"))
        tobresults2 = String.Join(",  ", strarr)

        Dim txtloblb1 As String
        Dim lin As ListItem
        Dim myArrayList1 As ArrayList = New ArrayList()
        Dim strarr1() As String

Need a string output from stored procedure


hai everyone,,

I got a situation now... i had a stored proc: How can i get the final select statement in the code behind.

Here is the stored proc.

ALTER PROCEDURE [dbo].[tgms_reclass_PO_bip](@po VARCHAR(20), @old_gl VARCHAR(20), @new_gl VARCHAR(20),@output varchar(500) out )

IF (SELECT COUNT(*) FROM mm2po WHERE scode = @po) = 0
    --SET @output = '1'
    SET @output = 'Invalid PO Number'

Check if Old GL Code is valid
IF (@output = '' AND (SELECT COUNT(*) FROM acct WHERE scode = REPLACE(@old_gl,'-','')) = 0)
    --SET @output = '2'
    SET @output = 'Invalid Old GL Account'

Check if New GL Code is valid
IF (@output = '' AND (SELECT COUNT(*) FROM acct WHERE scode = REPLACE(@new_gl,'-','')) = 0)
    --SET @output = '3'
    SET @output = 'Invalid New GL Account'


Split string


hi all

i want to spilt 115:USD:LKR this string from oracle script. return value should be 115.

pls provide me sql script


Split string after word


Hi everybody,

How can I split a string from some word.

string test = "Hellow world one two three";

I would lile to get the string part after the word world?? The result will be after splitting the string: "one two three"

split string sql server 2005



I have a table called SubjectRank that provides subject and it's ranking.

I have a string that can be in any format. It can be 'hello cat, how -are you lion?' or 'yes horse'. In short it can be received in any manner and i have no control on how user sends the string.

What I need to do is check if the string contains any words in the subject column. If yes I need to return that word.

In addition if the string contains more than one subject from the table than I must check the ranking and return the value with the highest ranking. (1 lowest) So if the string contains 'hello cat, how -are you lion?' the sp must return the word lion.


How can I achieve this?




String.Split with with tab as separator


I should read the substrings of this file:

1	1	-1738.20118241	6787.03549108	
2	2	-1803.20118241	6759.73549108	
3	3	-2193.20118241	6759.73549108	

I haved used the tab control "\t" as the separator (there is a tab character between the columns):

      Dim separator() As String = {"\t"}
      Console.WriteLine("separator(0) = {0}", separator(0))
        ' Open the file to read from.
        Using sr As StreamReader = File.OpenText(nomeFile)
          Do While sr.Peek() >= 0
            'Dim line As New StringBuilder
            Dim stringline As String
            Dim stringarray As String()
            Dim x, y, canale 

Split String on underscore



I have a long string and i want to split it on the bases of case change and underscore. here is the following pattern that split on the case change but i also want to split it on the underscore. Can somebody help me out.

private static final String DIVIDER_PATTERN =  "(?<=[^\\p{Upper}])(?=\\p{Upper})"  + "|(?<=[\\p{Lower}])(?=\\d)";

 this pattern split "MyFamilyNameIsFar" to "My Family Name Is Far" but i also want to split if there is underscore. like

"MyFamily_NameIs_Far" to  "My Family Name Is Far"

Can somebody tell me which modification i need in this pattern to handle these kind of situation.


your help would be appreciated.


With Best Regards

Split a string matching the following pattern




I would like to match a string that starts with RFF+ folllowed by 2 or 3 characters and followed by colon(:).

For instance accepted values are :











How to Encrypt Query String Parameters in ASP.NET

Encrypt Query String Parameters in ASP.NET.u can send secure data one page another page u can also use query string to encrypt

Connestion string create any database server

This links important to how to create connection string to any data base sever.

SQL Connection String

We can learn or know how can we connect the database from our .net. This will help for freshers or .NET beginners!

Using Conditional Split data Transfer in SSIS 2008

This article uses the Integration Services Conditional Split Data Transformation element to filter and transfer data from a set of flat text files to SQL Server database table. The concept can be easily extended to apply to any other source or destination such as Microsoft Excel. This scenario is useful in creating denormalized database tables in a reporting and analysis situation.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend