Need help with string manipulation...please! 
Author Message
 Need help with string manipulation...please!

What is the simplest way to get text1.text:

  Hayley Caulder     30    $30.00
to save to a disk as:
"Hayley Caulder",30,30.00
any help will be GREATLY APPRECIATED...
Cliff



Mon, 01 May 2000 03:00:00 GMT  
 Need help with string manipulation...please!

Quote:

>What is the simplest way to get text1.text:

>  Hayley Caulder     30    $30.00
>to save to a disk as:
>"Hayley Caulder",30,30.00
>any help will be GREATLY APPRECIATED...
>Cliff

Your need to create a parsing function based on some delimiter...
in your case maybe 2 spaces, i.e., "  ", that will take in a string
and send out the separate fields, say field1, field2....  Then write to
a file as follows:

dim fn as integer
fn =freefile
Open filename for output as #fn
    write #ifn, field1, field2, format(field3,"#0.00")
close fn

hope this helps

Fred



Mon, 01 May 2000 03:00:00 GMT  
 Need help with string manipulation...please!

Use InStr to detect where the first "   " is in the string then break it
with either MID$, Right$ or Left$.  BUT you asked for the simplist way:
use 3 text boxes.



Quote:
> What is the simplest way to get text1.text:

>   Hayley Caulder     30    $30.00
> to save to a disk as:
> "Hayley Caulder",30,30.00
> any help will be GREATLY APPRECIATED...
> Cliff



Mon, 01 May 2000 03:00:00 GMT  
 Need help with string manipulation...please!

Use the InStr and Mid functions searching for spaces, then store the
characters before them in variables then wrtie variables to file.
Es.
Dim pos_prec As Integer, pos As Integer
Dim spazio As String, riga As String
spazio = " "
Do
    pos_prec = pos
    pos = InStr(pos_prec+1 , stringa, spazio)
    If pos > 0 Then
      riga = Mid(stringa, pos_prec, pos - pos_prec)
    Else
      riga = Mid(stringa, pos_prec, 500)
      Exit Do
    End If
  Loop While riga <> ""


Quote:
> What is the simplest way to get text1.text:

>   Hayley Caulder     30    $30.00
> to save to a disk as:
> "Hayley Caulder",30,30.00
> any help will be GREATLY APPRECIATED...
> Cliff



Mon, 01 May 2000 03:00:00 GMT  
 Need help with string manipulation...please!

Quote:

>Cliff & Sue wrote
>>  Hayley Caulder     30    $30.00

Fred Replied

Quote:
>Your need to create a parsing function based on some delimiter...

Here's a function to do that.  It's based upon a routine in Dan
Appleman's win32 API book.

Call it like so

TempStringVar = ExtractWord(Number_of_word_to_extract, String,
Delimter)

Good luck and if anyone has any suggestions for making the routine any
better please send 'em my way.  I use this jewel alot!

Take Care, Zack Jones

Public Function ExtractWord(ByVal Position As Integer, ByVal Source As
String, ByVal Delimeter As String) As String
  Dim NextTab As Integer
  Dim BasePos As Integer
  Dim ThisPos As Integer
  Dim Res As String
  BasePos = 1
  ThisPos = 0
  Position = Position - 1
  If (Len(Source) = 0) Then
    ExtractWord = ""
    Exit Function
  End If
  Do
    NextTab = InStr(BasePos, Source, Delimeter)
    If NextTab = 0 Then NextTab = Len(Source) + 1
    If ThisPos = Position Then
      If NextTab - BasePos - 1 < 0 Then
        Res = ""
      Else
        Res = Mid(Source, BasePos, NextTab - BasePos)
      End If
      Exit Do
    End If
    BasePos = NextTab + 1
    ThisPos = ThisPos + 1
  Loop While (BasePos <= Len(Source))
  ExtractWord = Res
End Function



Fri, 05 May 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Please Help, string manipulation

2. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

3. string manipulation, string routines, etc.

4. Help please with format$ : need english strings

5. Help with String manipulations

6. Beginner String manipulation Help!

7. GPS NEMA string manipulation with VB5 help

8. GPS NEMA string manipulation with VB5 help

9. Student help - VB4 Proff String Manipulations - urgent

10. Help with VERY simple VB string manipulation

11. Help on string manipulation

12. String manipulation help

 

 
Powered by phpBB® Forum Software