RosettaCodeData/Task/String-matching/PureBasic/string-matching-1.basic
2023-07-01 13:44:08 -04:00

15 lines
455 B
Text

Procedure StartsWith(String1$, String2$)
Protected Result
If FindString(String1$, String2$, 1) =1 ; E.g Found in possition 1
Result =CountString(String1$, String2$)
EndIf
ProcedureReturn Result
EndProcedure
Procedure EndsWith(String1$, String2$)
Protected Result, dl=Len(String1$)-Len(String2$)
If dl>=0 And Right(String1$, Len(String2$))=String2$
Result =CountString(String1$, String2$)
EndIf
ProcedureReturn Result
EndProcedure