473,396 Members | 1,924 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,396 software developers and data experts.

Is there a way to split the contents of a string?

I have a string of the form '_10_245_' of varchar type to represent a list of integers.

Is there a way to extract the numbers out of that string?

examples of the string:

'_34_'

'_123_78_'

'_34_155_134_'

I manged to convert the string into the form of '34 155 134' using replace , ltrim and rtrim...but what should I do next?How can I split that string? As soon as I do that, I will convert each substring into int using the cast function.

Also note that the string it's not always the same; there's a column in a table containing those strings as its values.

Each of those numbers is a code and exists in another table A in an int column. Table A also provides each code's description in a varchar column.

I want to match each number in my string to its description in table A.

Any suggestions?

Thanks in advance
Nov 18 '08 #1
1 1161
ck9663
2,878 Expert 2GB
You have a "_" delimited string.

Option 1:

Parse it with a lot of substring or loop.

Option 2:
Use this technique.

-- CK
Nov 18 '08 #2

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

Similar topics

5
by: Stu Cazzo | last post by:
I have the following: String myStringArray; String myString = "98 99 100"; I want to split up myString and put it into myStringArray. If I use this: myStringArray = myString.split(" "); it...
1
by: TJ | last post by:
I am very new to C# (this is my first real project), therefore please be patient if my question is considered being to newbie. I am modifying a program which takes a text file, does some...
2
by: merrittr | last post by:
i am trying to split the contents of a textbox (the value will be a filespec path so \ are included) anyway how do I split on the \? strFileNameOnServer = uplTheFile.Value; char sep = @"\";...
3
by: Tempo | last post by:
Hey. I am trying to grab the prices from the string below but I get a few errors when I try to do it: Take a look at the code and error messages below for me and thanks you in advanced to all that...
12
by: Jay | last post by:
Let's say, for instance, that one was programming a spell checker or some other function where the contents of a string from a text-editor's text box needed to be split so that the resulting array...
8
by: Wijaya Edward | last post by:
Hi all, I was trying to split a string that represent chinese characters below: ??? But why the split function here doesn't seem
24
by: garyusenet | last post by:
I'm working on a data file and can't find any common delimmiters in the file to indicate the end of one row of data and the start of the next. Rows are not on individual lines but run accross...
11
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...
12
by: garyusenet | last post by:
string lines = File.ReadAllLines(@"c:\text\history.txt"); foreach (string s in lines) { ArrayList results = new ArrayList(); string delimit = ";"; string currentline = s.Split(";"); ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...

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.