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 Jul 10, 2003 | 01:54 PM
  #1  
Dream Weaver's Avatar
Dream Weaver
Thread Starter
Scooby Regular
25 Year Member
Liked
 
Joined: Feb 2000
Posts: 9,846
Likes: 4
From: Lancashire
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
Reply
Old Jul 10, 2003 | 02:08 PM
  #2  
David_Wallis's Avatar
David_Wallis
Scooby Regular
 
Joined: Nov 2001
Posts: 15,239
Likes: 1
From: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Post

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

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

http://www.aspalliance.com/nothingmn...ngmn_66&aid=66
Reply
Old Jul 10, 2003 | 02:41 PM
  #4  
Dream Weaver's Avatar
Dream Weaver
Thread Starter
Scooby Regular
25 Year Member
Liked
 
Joined: Feb 2000
Posts: 9,846
Likes: 4
From: Lancashire
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.
Reply
Old Jul 10, 2003 | 03:46 PM
  #5  
David_Wallis's Avatar
David_Wallis
Scooby Regular
 
Joined: Nov 2001
Posts: 15,239
Likes: 1
From: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
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
Reply
Old Jul 10, 2003 | 03:52 PM
  #6  
Dream Weaver's Avatar
Dream Weaver
Thread Starter
Scooby Regular
25 Year Member
Liked
 
Joined: Feb 2000
Posts: 9,846
Likes: 4
From: Lancashire
Post

Was just thinking along those lines, bloody nightmare problem this one.
Reply
Old Jul 10, 2003 | 04:06 PM
  #7  
David_Wallis's Avatar
David_Wallis
Scooby Regular
 
Joined: Nov 2001
Posts: 15,239
Likes: 1
From: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
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
Reply
Old Jul 10, 2003 | 04:07 PM
  #8  
David_Wallis's Avatar
David_Wallis
Scooby Regular
 
Joined: Nov 2001
Posts: 15,239
Likes: 1
From: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Post

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

David
Reply
Old Jul 10, 2003 | 04:10 PM
  #9  
AdrianFRST's Avatar
AdrianFRST
Scooby Regular
 
Joined: Oct 2000
Posts: 368
Likes: 0
Post

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




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