It is currently Mon Apr 06, 2020 3:26 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: [PB5.61] ReplaceString
PostPosted: Mon Jan 01, 2018 2:47 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Sep 20, 2004 7:12 am
Posts: 545
Location: Hell
Just stumbled across this a minute ago, had forgotten to set a variable (b$) and then my whole app freezes:
Code:
a$ = "this is a damn test"
a$ = ReplaceString(a$, b$, "oha", 1, #PB_String_NoCase)
Debug "hello?? were am I??"

_________________
Link dead?
Change h3x0r.ath.cx into hex0rs.coderbu.de and all will be fine.


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.61] ReplaceString
PostPosted: Mon Jan 01, 2018 2:58 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2341
Location: Germany
Confirmed on macOS

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.61] ReplaceString
PostPosted: Mon Jan 01, 2018 3:01 pm 
Offline
Addict
Addict

Joined: Thu Aug 30, 2007 11:54 pm
Posts: 1233
Location: right here
Arguments 'Mode' and 'StartPosition' are not in the right order (according to my PB 5.61), but it hangs with the correct order too. I'm on Linux.


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.61] ReplaceString
PostPosted: Mon Jan 01, 2018 3:09 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2011 3:47 am
Posts: 2305
Location: Singapore
HeX0R wrote:
Just stumbled across this a minute ago, had forgotten to set a variable (b$) and then my whole app freezes:
Code:
a$ = "this is a damn test"
a$ = ReplaceString(a$, b$, "oha", 1, #PB_String_NoCase)
Debug "hello?? were am I??"

Freezes only with the #PB_String_NoCase directive.

(tested with PureBasic v5.60 on Windows 8.1)

_________________
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too!


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.61] ReplaceString
PostPosted: Mon Jan 01, 2018 4:01 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Sep 20, 2004 7:12 am
Posts: 545
Location: Hell
#NULL wrote:
Arguments 'Mode' and 'StartPosition' are not in the right order (according to my PB 5.61), but it hangs with the correct order too. I'm on Linux.


ehm, yes sure, copy & paste error :mrgreen:

_________________
Link dead?
Change h3x0r.ath.cx into hex0rs.coderbu.de and all will be fine.


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.61] ReplaceString
PostPosted: Mon Jan 01, 2018 4:18 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 3235
Location: Boston, MA
Good catch, but...EnableExplicit :idea:
Asking to replace #Empty$ is probably an infinite loop.

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Top
 Profile  
Reply with quote  
 Post subject: Re: [PB5.61] ReplaceString
PostPosted: Mon Jan 01, 2018 5:14 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2011 3:47 am
Posts: 2305
Location: Singapore
skywalk wrote:
Good catch, but...EnableExplicit :idea:
Asking to replace #Empty$ is probably an infinite loop.

Code:
EnableExplicit
Define a$ = "this is a damn test", b$ = ""

a$ = ReplaceString(a$, b$, "oha")
Debug "works with default params."

a$ = ReplaceString(a$, #Empty$, "oha", #PB_String_CaseSensitive)
Debug "works with #PB_String_CaseSensitive."

a$ = ReplaceString(a$, b$, "oha", #PB_String_NoCase)   ;freezes!
Debug "only fails in the #PB_String_NoCase mode."

_________________
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: StarBootics and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye