Stupido string questions..

Just starting out? Need help? Post your questions and find answers here.
Killswitch
Enthusiast
Enthusiast
Posts: 731
Joined: Wed Apr 21, 2004 7:12 pm

Post by Killswitch »

Jesus, why are all of you producing such complicated solutions:

Code: Select all

String.s="aftershave"
Debug mid(String,findstring(String,"shave",1),len(String))
~I see one problem with your reasoning: the fact is thats not a chicken~
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

Killswitch wrote:Jesus, why are all of you producing such complicated solutions:

Code: Select all

String.s="aftershave"
Debug mid(String,findstring(String,"shave",1),len(String))
Because your solution doesn't cover both his scenarios. :twisted:
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Killswitch wrote:Jesus, why are all of you producing such complicated solutions:

Code: Select all

String.s="aftershave"
Debug mid(String,findstring(String,"shave",1),len(String))
Why is that less complicated than this?

Code: Select all

String.s = "aftershave"
Debug PeekS(@String.s+Len("shave"))
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

:lol:
I like logic, hence I dislike humans but love computers.
okasvi
Enthusiast
Enthusiast
Posts: 150
Joined: Wed Apr 27, 2005 9:41 pm
Location: Finland

Post by okasvi »

Trond wrote:
Killswitch wrote:Jesus, why are all of you producing such complicated solutions:

Code: Select all

String.s="aftershave"
Debug mid(String,findstring(String,"shave",1),len(String))
Why is that less complicated than this?

Code: Select all

String.s = "aftershave"
Debug PeekS(@String.s+Len("shave"))

because of
PeekS()

Syntax

Text$ = PeekS(*MemoryBuffer [, Length])
Description

For advanced programmers only. Very useful to catch a string at the specified memory address. The string should be ended by a '0' character, else it will read the memory until a '0' is encounter. An optional length parameter (in bytes) can be specified.
Supported OS

All
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Advanced but simple.
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Post by josku_x »

Well, atleast you all get the same result :lol:
Post Reply