Left(a$,-2); StringFieldSize(a$,seperator)

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Left(a$,-2); StringFieldSize(a$,seperator)

Post by GPI »

left(a$,-2) should be the same as left(a$,len(a$)-2), same for right(a$,-2)

Also a build in

Code: Select all

Procedure StringFieldSize(String$,Separator$)
  count=1
  For I=1 To Len(string$)
    If Mid(string$,i,1)=Separator$
      count+1
    EndIf
  Next
  ProcedureReturn count
EndProcedure
Would be nice.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Left(a$,-2); StringFieldSize(a$,seperator)

Post by Trond »

You mean like CountString()?
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Left(a$,-2); StringFieldSize(a$,seperator)

Post by netmaestro »

CountString would need to have 1 added to it to return the correct number of stringfields.

I like the idea but I think StringFieldCount() might be a more descriptive name. However, they seem to be moving away from Count()'s in favor of Size(), like ListSize(), etc. so maybe Size() would be better after all to conform with the rest.
BERESHEIT
Post Reply