|
-
Oct 13th, 2004, 03:22 AM
#1
Thread Starter
New Member
Trimming down "not SO empty" strings*resolved*
Well I guess this is a very basic question with a very basic answer but then again I'm a very basic programmer 
(Yes I do search the forum and the MSDN-library but it looks like I'm just bad at it )
-------------------------------------------------
Now I do have a textbox with limited Maxlength of 100 Chars
Whenever changed I send the text to strTemp (which also have a limited size of *100)
Now I want to trim down the string to just visible characters but the string is full of those stupid squares that does NOT count as empty but still doesn't show anything.
Reason why is that I want to shrink my filelength that is full of those "characters".
Briefly:
strNewString = trim(strTemp)
does not give me
strNewString = "" but strNewString= "..."
Is there an easy way to solve this or do I have to check the ascii codes of every car??? (sounds like a stupid idea)
Thanks!
Last edited by AJirenius; Oct 13th, 2004 at 04:28 AM.
-
Oct 13th, 2004, 03:28 AM
#2
Fanatic Member
Can you post some code.
Cheers
Rob
My secretary hopes that I will pay her, her landlord hopes that she will produce some rent, the Electricity Board hopes that he will settle their bill, and so on. I find it a wonderfully optimistic way of life. [Dirk Gently]
-
Oct 13th, 2004, 03:39 AM
#3
Thread Starter
New Member
Code:
Private Type Amne
intVal(10) As Integer
strSocial As String * 100
strAnsvar As String * 100
strOrdning As String * 100
strPrognos As String * 100
strOvrigt As String * 200
intSignatur As Integer
End Type
Private Type Omdome
Alla(12) As Amne
End Type
dim Elev(30) as Omdome
...
For n = 1 To ElevAntal
For m = 0 To 12
Print #intfnum, Elev(n - 1).Alla(m).intSignatur
For X = 0 To 10
Print #intfnum, Elev(n - 1).Alla(m).intVal(X)
Next X
Print #intfnum, Trim(Elev(n - 1).Alla(m).strAnsvar)
Print #intfnum, Trim(Elev(n - 1).Alla(m).strOrdning)
Print #intfnum, Trim(Elev(n - 1).Alla(m).strOvrigt)
Print #intfnum, Trim(Elev(n - 1).Alla(m).strPrognos)
Print #intfnum, Trim(Elev(n - 1).Alla(m).strSocial)
Next m
Next n
As the problem is inbedded in this code I give you the whole chunk.
Elev().Alla().strAnsvar and the similar strings are to be put into the file BUT they are now containing those "..." after the text the User writes down in the textbox (initating strAnsvar and the similar strings)
Trim doesnt remove these "squares either" and I need them gone as I'm working on an app that saves large files on floppydisks :S
Clearer??? guess not
-
Oct 13th, 2004, 03:58 AM
#4
Fanatic Member
Use this function:
Private Function TrimTheCrap(sString As String) As String
Dim iPos As Long
iPos = InStr(1, sString, Chr(0))
TrimTheCrap = Mid$(sString, 1, iPos - 1)
End Function
My secretary hopes that I will pay her, her landlord hopes that she will produce some rent, the Electricity Board hopes that he will settle their bill, and so on. I find it a wonderfully optimistic way of life. [Dirk Gently]
-
Oct 13th, 2004, 04:27 AM
#5
Thread Starter
New Member
Thanks Rob
I just added a row in case of iPos returning zero, otherwise it worked perfectly.
Case closed and resolved
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
|