|
-
Sep 6th, 2000, 05:44 AM
#1
Thread Starter
New Member
Hy guys,
I need some help with strings. The two strings show like this.
1. -Value1;-Value2;-Value3
2. -Value1;-Value2;-Value3;Value4
I would like to add all values with "-" in one string.
Thanks for help!
-
Sep 6th, 2000, 06:21 AM
#2
_______
<?>
what is your code and where are you loading the strings
is the string an array with ; as a delimiter
or do you have a file with a bunch of numbers
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Sep 6th, 2000, 06:40 AM
#3
Thread Starter
New Member
Sorry
Both strings are arrays an the ; is the delimiter
the second string is comeing from a file
the first from the registry
-
Sep 6th, 2000, 06:45 AM
#4
transcendental analytic
Code:
For Each Item in arrayname
singlestring=singlestring & "-" & Item
next Item
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Sep 6th, 2000, 07:35 AM
#5
_______
<?>
Code:
Option Explicit
Private Sub Form_Load()
Dim Sfile As String, var1 As String
Dim sResult As Variant
'Sfile = "yourpath/yourfile/ext"
var1 = "-4;-4;-4;6;6"
'Open Sfile For Input As intNum
'read the complete file into a string variable
'var1 = StrConv(InputB(LOF(intNum), intNum), vbUnicode)
' Close intNum
Dim i As Integer
'use the split function to split the string
'into sections using the ; as the split pos
sResult = Split(var1, ";")
'read the split into the public array
Dim myArr() As Integer
For i = 0 To UBound(sResult)
ReDim Preserve myArr(i)
myArr(i) = Trim(sResult(i))
Next i
For i = 1 To UBound(myArr)
If Left(myArr(i), 1) = "-" Then
myArr(i) = myArr(i) + myArr(i - 1)
End If
Next i
'display
For i = 1 To UBound(myArr)
MsgBox myArr(i)
Next i
' then rejoin the array...and put it back or whatever you
'plan on doing
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|