Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Join 2 comma delimited number strings in ASP

Thread Tools
 
Search this Thread
 
Old 10 July 2003, 01:54 PM
  #1  
Dream Weaver
Scooby Regular
Thread Starter
 
Dream Weaver's Avatar
 
Join Date: Feb 2000
Location: Lancashire
Posts: 9,844
Received 0 Likes on 0 Posts
Question

OK here's a toughie that I'm working on.

Take 2 text strings of integers, separated by a comma for each number: (Strings are held in a database text field).

Example:
String 1 - 12,10,4,8,19
String 2 - 11,7,6,8,10,14

Join them together in one long string, but omit the duplicated numbers.

Result required - 12,10,4,8,19,11,7,6,14

So far I can grab string 1 and string 2, and I can append one to the other, but it includes duplicates.

Anyone any ideas? Currently using arrays to split the strings into single numbers.

DW
Old 10 July 2003, 02:08 PM
  #2  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

can think of a few ways of doing it, but nothing simple or short..

David
Old 10 July 2003, 02:10 PM
  #3  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

http://www.aspalliance.com/nothingmn...ngmn_66&aid=66
Old 10 July 2003, 02:41 PM
  #4  
Dream Weaver
Scooby Regular
Thread Starter
 
Dream Weaver's Avatar
 
Join Date: Feb 2000
Location: Lancashire
Posts: 9,844
Received 0 Likes on 0 Posts
Post

Cheers David, but the code looks a bit of an overkill for my purposes as the string is split only into full integers, i.e no text involved.

In theory, if I splt the string into integers, there should be a way of actually using the numbers (maths calc) and removing duplicates, then transferring the numbers back into a string.

Some more searching required I think.
Old 10 July 2003, 03:46 PM
  #5  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

suppose create two arrays.. take value from second array then compare it to each one of members of the array its joining a match is found then skip else add it in..

Make sense??

David
Old 10 July 2003, 03:52 PM
  #6  
Dream Weaver
Scooby Regular
Thread Starter
 
Dream Weaver's Avatar
 
Join Date: Feb 2000
Location: Lancashire
Posts: 9,844
Received 0 Likes on 0 Posts
Post

Was just thinking along those lines, bloody nightmare problem this one.
Old 10 July 2003, 04:06 PM
  #7  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

not syntax correct but logic correct??

arrayOne(0) = 1
arrayOne(1) = 2

arrayTwo(0) = 1
arrayTwo(1) = 4

for x = 0 to ArrayTwoItemCount
For y = 1 to ArrayOneItemCount
If Arraytwo(y) <> ArrayOne(x) then
ArrayOne(ArrayOneItemCount + 1) = Arraytwo(y)
' Delete item from Array two
' Redim Array?
Else
' Delete Duplicate
End If
Next Y
Next x


Have a look at it in 'edit post'..

David

Trending Topics

Old 10 July 2003, 04:07 PM
  #8  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

dont think you can do nested for loops, so may have to use a do while or similar..

David
Old 10 July 2003, 04:10 PM
  #9  
AdrianFRST
Scooby Regular
 
AdrianFRST's Avatar
 
Join Date: Oct 2000
Posts: 368
Likes: 0
Received 0 Likes on 0 Posts
Post

You can do nested "for" loops btw.
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Frizzle-Dee
Essex Subaru Owners Club
13
01 December 2015 09:37 AM
Ganz1983
Subaru
5
02 October 2015 09:22 AM
thunder8
General Technical
0
01 October 2015 09:13 PM
Raptorman
ScoobyNet General
0
01 October 2015 06:46 PM
shorty87
Other Marques
0
25 September 2015 08:52 PM



Quick Reply: Join 2 comma delimited number strings in ASP



All times are GMT +1. The time now is 04:44 PM.