about PeekS
Posted: Tue Nov 29, 2016 9:12 am
				
				how to let Trond code here to work in PB 5.50 :
http://purebasic.fr/english/viewtopic.php?f=13&t=25999
Thanks
			http://purebasic.fr/english/viewtopic.php?f=13&t=25999
Thanks
Code: Select all
a$ = "the cat in the hat "
Length = Len(a$)
For t=1 To Length
  Letter.s = PeekS(Ascii(a$)+t-1, 1, #PB_UTF8)
  Word.s = Word + Letter
  If Letter = " "
    Debug Word + "."
   ; or some other process
    Word = ""
  EndIf
Nextthe .
cat .
in .
the .
hat .
Code: Select all
a$ = "the cat in the hat "
Length = Len(a$)
For t=1 To Length
  Letter.s = PeekS(@a$+(t-1)*SizeOf(Character), 1)
  Word.s = Word + Letter
  If Letter = " "
    Debug Word + "."
   ; or some other process
    Word = ""
  EndIf
NextCode: Select all
a$ = "the cat in the hat "
Length = Len(a$)
For t=1 To Length
  Letter.s = PeekS(a$+(t-1) * SizeOf(Character), 1)
  Word.s = Word + Letter
  If Letter = " "
    Debug Word + "."
   ; or some other process
    Word = ""
  EndIf
Next no i know StringField() is a good and better choice https://www.purebasic.com/documentation ... field.htmlStringField(). Is there a reason to dismiss it and look elsewhere?
StringField()?applePi wrote:it is may be not available in 2007 purebasic version