Special replace string problem

Just starting out? Need help? Post your questions and find answers here.
willib
User
User
Posts: 39
Joined: Mon Sep 15, 2003 7:04 pm
Location: Bielefeld

Special replace string problem

Post by willib »

Hi Pure freaks

I want to change the Data of a string like
change stringposition 6 o "Z"
the only way I see is to code

Code: Select all

a.s="1234567890"
a.s=Left(a.s,5)+"Z"+Right(a.s,4)
Debug a"
isn`t here an easier way to do this , maybe with poke ?!?

Best regards.

Willib
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Re: Special replace string problem

Post by traumatic »

willib wrote:maybe with poke ?!?
like PokeB(@a+5, 'Z') ?

Can't see a use in this though ;)
Good programmers don't comment their code. It was hard to write, should be hard to read.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

a.s="1234567890"
PokeB(@a+5,'Z')
Debug a
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

darn traumatic was faster...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
willib
User
User
Posts: 39
Joined: Mon Sep 15, 2003 7:04 pm
Location: Bielefeld

Post by willib »

Many thanks
Is it sure that a string is always successively in Storage.
ore are there any restrictions ?

best regards
Willib
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

yes
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

but if you poke outside the string your program may crash or something else will happen.. [dont worry 'bout your windows, as the program memory space is protected.. to poke outside your program you need some api commands..]
eevee
User
User
Posts: 69
Joined: Sat Jan 08, 2005 6:24 pm
Location: UK

Post by eevee »

Where were you lot when I needed you?????????

viewtopic.php?t=13810

:cry:
Regards,

Ernest
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

eevee wrote:Where were you lot when I needed you?????????
huh?
Good programmers don't comment their code. It was hard to write, should be hard to read.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

:-)

it's all in asking the *right* question :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
eevee
User
User
Posts: 69
Joined: Sat Jan 08, 2005 6:24 pm
Location: UK

Post by eevee »

Or perhaps in the right board??????????
Regards,

Ernest
Post Reply