Main Menu

Trim Right Word

Started by kevin, March 09, 2008, 05:51:50 AM

Previous topic - Next topic

kevin

 TrimRightWord

 This function removes a word or group of chr's from the end of string..


PlayBASIC Code: [Select]
   ; Print Hello World is the word "World" removed from the end.. So the result is 'HELLO' 
Print TrimRightWord("Hello World","World")

Sync
Waitkey

Function TrimRightWord(InputString$,TrimWord$)
pos=Len(InputString$)-(Len(TrimWord$))
if TrimWord$=Right$(inputString$,pos-1)
InputString$=Left$(InputString$,pos)
endif
EndFunction InputString$