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

i had an array with duplicate values

chandru8
145 100+
hi to all
i had an array with duplicate values like
a(1) = "A"
a(2) ="B"
a(3) = "C"
a(4) = "A"
a(5) = "A"
A value has been repeated so that i need to concateate "Dup" to that value
a(1) = "ADuplicate"
a(2) ="B"
a(3) = "C"
a(4) = "A"
a(5) = "A"

other than this "A" should not be altered.
thanks for your help in advance
its urgent,
Feb 20 '08 #1
3 1111
QVeen72
1,445 Expert 1GB
Hi,

4th and 5th Values also have "A".. you dont want to concatenate "Dup" to those Items..?


REgards
Veena
Feb 20 '08 #2
chandru8
145 100+
hi thanks for you reply
we need to conc for only one value
Feb 20 '08 #3
QVeen72
1,445 Expert 1GB
Hi,

Try this code:

tarr >> is your Array
narr is Array with new values..

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command_Click()
  2.     '
  3.     Dim j As Integer
  4.     Dim i As Integer
  5.     Dim TStr As String
  6.     Dim TFlag As Boolean
  7.     Dim TItem As Integer
  8.     Dim tarr(1 T 10) 
  9.     Dim narr(1 To 10)
  10.     '
  11.     ' Write code here To Redim new array
  12.    '
  13.     For i = LBound(tarr) To UBound(tarr)
  14.         TItem = -1
  15.         TFlag = False
  16.         TStr = tarr(i)
  17.         For j = 1 To (i - 1)
  18.             If TStr = tarr(j) Then
  19.                 TFlag = True
  20.                 TItem = j
  21.                 Exit For
  22.             End If
  23.         Next
  24.         narr(i) = TStr
  25.         If TFlag Then
  26.             narr(TItem) = TStr & "Dup"
  27.         End If
  28.     Next
  29. End Sub
  30.  
at the end write one more for loop to transfer data from narr to tarr..


REgards
Veena
Feb 20 '08 #4

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

Similar topics

2
by: Patrick G. | last post by:
Greetings all: ASP VB, SQL Svr 2000 I am pulling data from 3 tables. table1 holds item details table2 holds publication types and the item id from table1 table3 holds category types and...
5
by: CJM | last post by:
In an application I'm working the user has the opportunity to record the despatching of one or more items with serial numbers. For each item they despatch, they have to chose the serial no that...
7
by: simkn | last post by:
Hello, I'm writing a function that updates an array. That is, given an array, change each element. The trick is this: I can't change any elements until I've processed the entire array. For...
4
by: jonny | last post by:
Hey I need to search an array list to remove duplicate Data The list is populated by a search function that enters in a name if the it is told too This causes duplicate names to be entered...
5
by: Paulers | last post by:
Hello all, I have a string array with duplicate elements. I need to create a new string array containing only the unique elements. Is there an easy way to do this? I have tried looping through...
1
by: JTreefrog | last post by:
Hello - I've read a ton of stuff about deleting duplicate values in an array. They are all very useful - they just haven't addressed an array of objects. Here's my array: var sDat = ; The...
12
by: joestevens232 | last post by:
Hello Im having problems figuring out how to remove the duplicate entries in an array...Write a program that accepts a sequence of integers (some of which may repeat) as input into an array. Write...
10
chandru8
by: chandru8 | last post by:
hi to all iam using vb6.0 can any one tell me how to duplicate values in a array if possible i want to delete the duplicate values its urgent thanks
2
by: yeshello54 | last post by:
so here is my problem...in a contact manager i am trying to complete i have ran into an error..we have lots of code because we have some from class which we can use...anyways i keep getting an error...
2
by: dawn123 | last post by:
I have a 2-d array that the user enters tress species and diameter so it looks something like: sm 10 rm 18 bf 12 sm10 sm10 rm18 and so on.. I need to be able to seach though my array and find...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.