January 24, 2021, 01:19:25 PM

Author Topic: [bb] Extract a number under a string with SPACE by Filax [ 1+ years ago ]  (Read 433 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
Title : Extract a number under a string with SPACE
Author : Filax
Posted : 1+ years ago

Description : Use it for your lan coding !

Code :
Code: BlitzBasic
  1. Pos$="-455.12456 -23.52 12.2656"
  2.  
  3. Print Pos$
  4. Print
  5. Print Proc_ValueDepack(Pos$,1)
  6. Print Proc_ValueDepack(Pos$,2)
  7. Print Proc_ValueDepack(Pos$,3)
  8. WaitKey
  9.  
  10. Function Proc_ValueDepack$(Dat$,Value)
  11.         Local SearchValue$=""
  12.         Local SpaceChar$=""
  13.         Local String_Counter=1
  14.  
  15.         For Decrunch = 1 To Len(Dat$)
  16.                 SpaceChar$ = Mid(Dat$,Decrunch,1)
  17.  
  18.                 If SpaceChar$ = " " Then
  19.                         String_Counter= String_Counter + 1
  20.                 Else If String_Counter = Value Then
  21.                 SearchValue$=SearchValue$+SpaceChar$
  22.                 EndIf
  23.         Next
  24.  
  25.         Return SearchValue$
  26. End Function


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal